@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.
Files changed (28) hide show
  1. package/package.json +1 -1
  2. package/src/sap/suite/ui/generic/template/.library +1 -1
  3. package/src/sap/suite/ui/generic/template/AnalyticalListPage/manifest.json +1 -1
  4. package/src/sap/suite/ui/generic/template/Canvas/manifest.json +1 -1
  5. package/src/sap/suite/ui/generic/template/ListReport/controller/ControllerImplementation.js +92 -9
  6. package/src/sap/suite/ui/generic/template/ListReport/controller/IappStateHandler.js +19 -8
  7. package/src/sap/suite/ui/generic/template/ListReport/manifest.json +1 -1
  8. package/src/sap/suite/ui/generic/template/ListReport/view/fragments/SmartChart.fragment.xml +3 -2
  9. package/src/sap/suite/ui/generic/template/ListReport/view/fragments/SmartTable.fragment.xml +5 -4
  10. package/src/sap/suite/ui/generic/template/ObjectPage/controller/ControllerImplementation.js +7 -4
  11. package/src/sap/suite/ui/generic/template/ObjectPage/manifest.json +1 -1
  12. package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/SmartChart.fragment.xml +3 -2
  13. package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/SmartTable.fragment.xml +3 -2
  14. package/src/sap/suite/ui/generic/template/QuickCreate/manifest.json +1 -1
  15. package/src/sap/suite/ui/generic/template/QuickView/manifest.json +1 -1
  16. package/src/sap/suite/ui/generic/template/genericUtilities/ControlStateWrapperFactory.js +108 -67
  17. package/src/sap/suite/ui/generic/template/genericUtilities/controlHelper.js +29 -29
  18. package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/DynamicPageWrapper.js +19 -51
  19. package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/ObjectPageLayoutWrapper.js +10 -32
  20. package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/PreliminaryWrapper.js +151 -0
  21. package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SearchFieldWrapper.js +8 -30
  22. package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartFilterBarWrapper.js +49 -162
  23. package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartTableChartCommon.js +100 -94
  24. package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartTableWrapper.js +22 -3
  25. package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartVariantManagementWrapper.js +90 -81
  26. package/src/sap/suite/ui/generic/template/lib/AppComponent.js +1 -1
  27. package/src/sap/suite/ui/generic/template/lib/navigation/NavigationController.js +1 -1
  28. package/src/sap/suite/ui/generic/template/library.js +1 -1
@@ -8,18 +8,19 @@ sap.ui.define([
8
8
  "sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/DynamicPageWrapper",
9
9
  "sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartVariantManagementWrapper",
10
10
  "sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/ObjectPageLayoutWrapper",
11
- "sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SearchFieldWrapper"
11
+ "sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SearchFieldWrapper",
12
+ "sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/PreliminaryWrapper"
12
13
  ], function (BaseObject, extend, controlHelper, SmartFilterBarWrapper, SmartTableWrapper, SmartChartWrapper,
13
- DynamicPageWrapper, SmartVariantManagementWrapper, ObjectPageLayoutWrapper, SearchFieldWrapper) {
14
+ DynamicPageWrapper, SmartVariantManagementWrapper, ObjectPageLayoutWrapper, SearchFieldWrapper, PreliminaryWrapper) {
14
15
  "use strict";
15
-
16
+
16
17
  /**
17
18
  * Dummy wrapper for not existing or not (yet) supported controls (either not carrying a state or to be added in future). Also used as interface description for wrapper classes.
18
19
  */
19
20
  var oDummyWrapper = {
20
21
  /**
21
22
  * Retrieve the current state of the control
22
- *
23
+ *
23
24
  * @return {object} serializable json object describing the current state of the control. Will be provided to setState exactly the same when restoring the state. Note: Structure of this object
24
25
  * is up to the wrapper, no one outside will rely on it - with one exception: legacyStateHandler translates legacy states (without clear separation per control) to this format. Open:
25
26
  * Should legacyStateHandler be responsible for providing most current version, or only first control specific version (i.e. first version using wrapper), and wrapper should be
@@ -28,7 +29,7 @@ sap.ui.define([
28
29
  getState: Function.prototype,
29
30
  /**
30
31
  * Restore the control to the given state
31
- *
32
+ *
32
33
  * @param {object} oState json object describing the state as provided by getState. Note: can also be undefined, if an old state is restored (from a release where the state of this control was
33
34
  * not stored), if a state is provided in the URL that cannot be read (anymore), or on OP in discovery mode, if the user navigates to a new object instance - in these cases, the
34
35
  * control has to be brought (back) into its initial state. Currently, expectation is the state to be restored synchronously. Planned:
@@ -40,13 +41,13 @@ sap.ui.define([
40
41
  * wrapper must provide an event to indicate a state change. Must be called whenever a user interacts with the control to change its state, but not when state is changed programmatically (e.g.
41
42
  * from setState, or when user interacts with a different control causing also this one to change (in that case, the event from the other control should be called) Function to register for that
42
43
  * event
43
- *
44
+ *
44
45
  * @param {function} fnHandler event handler function being attached
45
46
  */
46
47
  attachStateChanged: Function.prototype,
47
48
  /**
48
49
  * Function to deregister from event. Currently not used, but should be provided for symmetry reasons.
49
- *
50
+ *
50
51
  * @param {function} fnHandler event handler function being attached. Should only be deregistered, if provided exactly like in registration
51
52
  */
52
53
  detachStateChanged: Function.prototype,
@@ -57,7 +58,7 @@ sap.ui.define([
57
58
 
58
59
  /**
59
60
  * Returns true if the state provided as argument is same as the state applied.
60
- * @param {Object} oState State object which needs to be checked against the current
61
+ * @param {Object} oState State object which needs to be checked against the current
61
62
  * state of the wrapper.
62
63
  * @returns {boolean} True in case State object passed as argument match with current state else false.
63
64
  */
@@ -90,15 +91,66 @@ sap.ui.define([
90
91
  };
91
92
  return extend({}, oWrapper, oOverride);
92
93
  }
93
-
94
+
95
+ /**
96
+ * Private helper function to create the real wrapper based on type and control.
97
+ * This function is injected into PreliminaryWrapper and not exposed in the factory's public API.
98
+ * Parameters are ordered to allow using .bind() for partial application.
99
+ *
100
+ * @param {string} sType - The type of control (e.g., "SmartTable", "SmartChart")
101
+ * @param {object} [mParams] - Additional parameters passed to constructor of wrapper
102
+ * @param {sap.ui.core.Control} oControl - The control instance (last to enable .bind())
103
+ * @return {object} The real wrapper object for the control with helper methods attached
104
+ */
105
+ function fnCreateRealWrapper(sType, mParams, oControl) {
106
+ var oWrapper;
107
+ switch (sType) {
108
+ case "SmartFilterBar":
109
+ oWrapper = new SmartFilterBarWrapper(oControl, oFactory, mParams);
110
+ break;
111
+ case "SmartTable":
112
+ oWrapper = new SmartTableWrapper(oControl, oController, oFactory);
113
+ break;
114
+ case "SmartChart":
115
+ oWrapper = new SmartChartWrapper(oControl, oController, oFactory);
116
+ break;
117
+ case "DynamicPage":
118
+ oWrapper = new DynamicPageWrapper(oControl);
119
+ break;
120
+ case "SmartVariantManagement":
121
+ oWrapper = new SmartVariantManagementWrapper(oControl, oController, oFactory, mParams);
122
+ break;
123
+ case "ObjectPageLayout":
124
+ oWrapper = new ObjectPageLayoutWrapper(oControl);
125
+ break;
126
+ case "SearchField":
127
+ oWrapper = new SearchFieldWrapper(oControl);
128
+ break;
129
+ default:
130
+ // control not carrying a state or no wrapper built yet
131
+ oWrapper = oDummyWrapper;
132
+ }
133
+
134
+ // Add helper methods to the real wrapper
135
+ var sId = oController.getView().getLocalId(oControl.getId());
136
+ oWrapper.getLocalId = function() { return sId; };
137
+ oWrapper.isCurrentState = oWrapper.isCurrentState || function (oState) {
138
+ return JSON.stringify(oState) === JSON.stringify(oWrapper.getState());
139
+ };
140
+
141
+ return oWrapper;
142
+ }
143
+
94
144
  var oFactory = {
95
145
  getSuppressChangeEventWhenApplyingWrapper: getSuppressChangeEventWhenApplyingWrapper,
146
+
96
147
  /**
97
- * Factory function to generate control wrapper object based on control type
98
- *
148
+ * Factory function to generate control wrapper object based on control type.
149
+ * Always returns a PreliminaryWrapper, which delegates to the real wrapper internally.
150
+ *
99
151
  * @param {sap.ui.core.Control} oControl - control a wrapper should be provided for
100
152
  * @param {object} [mParams] - map with any additional parameters passed to constructor of wrapper
101
- * @return {object} wrapper object for the control
153
+ * @return {object} wrapper object for the control (always a PreliminaryWrapper)
102
154
  */
103
155
  getControlStateWrapper: function (oControl, mParams) {
104
156
  // checking for control here (instead of at all callers) allows simple use for optional controls
@@ -107,52 +159,66 @@ sap.ui.define([
107
159
  // no need to add the dummy to the map
108
160
  return oDummyWrapper;
109
161
  }
110
- var sId = oController.getView().getLocalId(oControl.getId());
162
+ var sId = oController.getView().getLocalId(oControl.getId());
163
+
111
164
  if (!mWrappers[sId]) {
112
- var oWrapper;
165
+ // Determine control type
166
+ var sType;
113
167
  switch (true) {
114
168
  case controlHelper.isSmartFilterBar(oControl):
115
- oWrapper = new SmartFilterBarWrapper(oControl, oFactory, mParams);
169
+ sType = "SmartFilterBar";
116
170
  break;
117
171
  case controlHelper.isSmartTable(oControl):
118
- oWrapper = new SmartTableWrapper(oControl, oController, oFactory);
172
+ sType = "SmartTable";
119
173
  break;
120
174
  case controlHelper.isSmartChart(oControl):
121
- oWrapper = new SmartChartWrapper(oControl, oController, oFactory);
175
+ sType = "SmartChart";
122
176
  break;
123
177
  case controlHelper.isDynamicPage(oControl):
124
- oWrapper = new DynamicPageWrapper(oControl);
178
+ sType = "DynamicPage";
125
179
  break;
126
180
  case controlHelper.isSmartVariantManagement(oControl):
127
- oWrapper = new SmartVariantManagementWrapper(oControl, oController, oFactory, mParams);
181
+ sType = "SmartVariantManagement";
128
182
  break;
129
183
  case controlHelper.isObjectObjectPageLayout(oControl):
130
- oWrapper = new ObjectPageLayoutWrapper(oControl);
184
+ sType = "ObjectPageLayout";
131
185
  break;
132
186
  case controlHelper.isSearchField(oControl):
133
- oWrapper = new SearchFieldWrapper(oControl);
187
+ sType = "SearchField";
134
188
  break;
135
189
  default:
136
- // control not carrying a state or no wrapper build yet
137
- oWrapper = oDummyWrapper;
190
+ // control not carrying a state or no wrapper built yet
191
+ return oDummyWrapper;
138
192
  }
139
- oWrapper.getLocalId = function() { return sId; };
140
- oWrapper.isCurrentState = oWrapper.isCurrentState || function (oState) {
141
- return JSON.stringify(oState) === JSON.stringify(oWrapper.getState());
142
- };
143
-
144
- mWrappers[sId] = oWrapper;
193
+
194
+ // Create bound function with type and params, leaving oControl to be provided later
195
+ var fnBoundCreator = fnCreateRealWrapper.bind(null, sType, mParams);
196
+
197
+ // Always create a PreliminaryWrapper
198
+ var oPreliminaryWrapper = new PreliminaryWrapper(sId, fnBoundCreator);
199
+
200
+ // Since control is available, immediately set it
201
+ oPreliminaryWrapper.setControl(oControl);
202
+
203
+ // Store the PreliminaryWrapper in map (not the real wrapper)
204
+ mWrappers[sId] = oPreliminaryWrapper;
205
+ } else if (mWrappers[sId].setControl) {
206
+ // PreliminaryWrapper already exists but control wasn't set yet - set it now
207
+ mWrappers[sId].setControl(oControl);
145
208
  }
209
+
146
210
  return mWrappers[sId];
147
211
  },
148
212
 
149
213
  /**
150
- * Factory function to generate control wrapper object based on control type
151
- *
152
- * @param {string} sId - Id of the control for which wrapper needs to be initiated
214
+ * Factory function to generate control wrapper object based on control ID and type.
215
+ * Creates a PreliminaryWrapper when the control doesn't exist yet (e.g., lazy loading).
216
+ * Always returns a PreliminaryWrapper, which delegates to the real wrapper internally.
217
+ *
218
+ * @param {string} sControlId - ID of the control for which wrapper needs to be initiated
153
219
  * @param {string} sControlType - Type of the control for which wrapper needs to be initiated
154
220
  * @param {object} [mParams] - map with any additional parameters passed to constructor of wrapper
155
- * @return {object} wrapper object for the control
221
+ * @return {object} wrapper object for the control (always a PreliminaryWrapper)
156
222
  */
157
223
  getControlStateWrapperById: function (sControlId, sControlType, mParams) {
158
224
  // checking for control here (instead of at all callers) allows simple use for optional controls
@@ -161,40 +227,15 @@ sap.ui.define([
161
227
  // no need to add the dummy to the map
162
228
  return oDummyWrapper;
163
229
  }
164
- var sId = oController.getView().getLocalId(sControlId);
230
+ var sId = oController.getView().getLocalId(sControlId);
165
231
  if (!mWrappers[sId]) {
166
- var oWrapper;
167
- switch (sControlType) {
168
- case "SmartFilterBar":
169
- oWrapper = new SmartFilterBarWrapper(sControlId, oFactory, mParams);
170
- break;
171
- case "SmartTable":
172
- oWrapper = new SmartTableWrapper(sControlId, oController, oFactory);
173
- break;
174
- case "SmartChart":
175
- oWrapper = new SmartChartWrapper(sControlId, oController, oFactory);
176
- break;
177
- case "DynamicPage":
178
- oWrapper = new DynamicPageWrapper();
179
- break;
180
- case "SmartVariantManagement":
181
- oWrapper = new SmartVariantManagementWrapper(sControlId, oController, oFactory, mParams);
182
- break;
183
- case "ObjectPageLayout":
184
- oWrapper = new ObjectPageLayoutWrapper(sControlId);
185
- break;
186
- case "SearchField":
187
- oWrapper = new SearchFieldWrapper(sControlId);
188
- break;
189
- default:
190
- // control not carrying a state or no wrapper build yet
191
- oWrapper = oDummyWrapper;
192
- }
193
- oWrapper.getLocalId = function() { return sId; };
194
- oWrapper.isCurrentState = oWrapper.isCurrentState || function (oState) {
195
- return JSON.stringify(oState) === JSON.stringify(oWrapper.getState());
196
- };
197
- mWrappers[sId] = oWrapper;
232
+ // Create bound function with type and params, leaving oControl to be provided later
233
+ var fnBoundCreator = fnCreateRealWrapper.bind(null, sControlType, mParams);
234
+
235
+ // Create a PreliminaryWrapper (control will be set later)
236
+ var oPreliminaryWrapper = new PreliminaryWrapper(sId, fnBoundCreator);
237
+
238
+ mWrappers[sId] = oPreliminaryWrapper;
198
239
  }
199
240
  return mWrappers[sId];
200
241
  }
@@ -207,4 +248,4 @@ sap.ui.define([
207
248
  extend(this, getMethods(oController));
208
249
  }
209
250
  });
210
- });
251
+ });
@@ -1,29 +1,29 @@
1
1
  sap.ui.define([
2
- "sap/ui/dom/getFirstEditableInput",
2
+ "sap/ui/dom/getFirstEditableInput",
3
3
  "sap/suite/ui/generic/template/genericUtilities/FeLogger",
4
4
  "sap/ui/core/Element",
5
5
  "sap/ui/table/plugins/MultiSelectionPlugin"
6
6
  ], function(getFirstEditableInput, FeLogger, Element, MultiSelectionPlugin) {
7
7
  "use strict";
8
-
8
+
9
9
  var oFeLogger = new FeLogger("genericUtilities.controlHelper");
10
10
  var oLogger = oFeLogger.getLogger();
11
-
11
+
12
12
  var byId = Element.getElementById;
13
-
13
+
14
14
  function isControlOfType(sPathToType, oControl){
15
15
  var FNClass = sap.ui.require(sPathToType);
16
16
  return typeof FNClass === "function" && (oControl instanceof FNClass);
17
17
  }
18
-
18
+
19
19
  function getUI5ControlForDomElement(oDom){
20
20
  for (; oDom; oDom = oDom.parentNode) {
21
21
  if (oDom.hasAttribute && oDom.hasAttribute("data-sap-ui")) {
22
22
  return byId(oDom.id);
23
23
  }
24
- }
24
+ }
25
25
  }
26
-
26
+
27
27
  function focusUI5Control(oControl, oFocusInfo){
28
28
  if (oControl && oControl.focus) {
29
29
  oLogger.debug("Set focus on control with id " + oControl.getId());
@@ -52,9 +52,9 @@ sap.ui.define([
52
52
  if (oTest !== oControl){
53
53
  oLogger.warning(oCurrentFocus ? ("Focus is now on control with id " + oCurrentFocus.getId()) : "There is no focus now");
54
54
  }
55
- }
55
+ }
56
56
  }
57
-
57
+
58
58
  function focusDom(oDom, oFocusInfo){
59
59
  var oUi5Control = getUI5ControlForDomElement(oDom);
60
60
  focusUI5Control(oUi5Control, oFocusInfo);
@@ -66,12 +66,12 @@ sap.ui.define([
66
66
  }
67
67
 
68
68
  // returns a Promise that resolves to the boolean information whether the SmartField is a possible focus target for input.
69
- function getSmartFieldIsFocussableForInputPromise(oSmartField) {
69
+ function getSmartFieldIsFocussableForInputPromise(oSmartField, isSmartForm) {
70
70
  return oSmartField._getComputedMetadata().then(function () {
71
71
  return (oSmartField.getMode() === "edit") && (oSmartField._getICRenderedPromise() || Promise.resolve());
72
72
  }).then(function () {
73
- var oFirstFocusableInput = !oSmartField._bEdmBoolDetected && getFirstEditableInput(oSmartField.getDomRef());
74
- return !(!oFirstFocusableInput || oFirstFocusableInput.type === "checkbox");
73
+ var oFirstFocusableInput = (!oSmartField._bEdmBoolDetected || isSmartForm) && getFirstEditableInput(oSmartField.getDomRef());
74
+ return !(!oFirstFocusableInput || (oFirstFocusableInput.type === "checkbox" && !isSmartForm));
75
75
  }).catch(function () {
76
76
  return false;
77
77
  });
@@ -82,12 +82,12 @@ sap.ui.define([
82
82
  function getControlWithFocus(){
83
83
  return getUI5ControlForDomElement(document.activeElement);
84
84
  }
85
-
85
+
86
86
  // Returns the parent of a given sap.ui.core.Element, but considers that for Components the parent is to be found via the oContainer property.
87
87
  function getParent(oElement){
88
88
  return oElement.getParent() || oElement.oContainer;
89
89
  }
90
-
90
+
91
91
  // If oChild is identified to be invisible, null is returned. Otherwise its parent is returned.
92
92
  // If the parent does not exist a faulty value is returned.
93
93
  // This is a heuristic method.
@@ -113,7 +113,7 @@ sap.ui.define([
113
113
  }
114
114
  return vRet;
115
115
  }
116
-
116
+
117
117
  // Return a list of all children of the given control (in the 'correct' order). Only implemented for certain control types.
118
118
  // For the other control types it returns null or an empty array depending on bAlwaysReturnAList.
119
119
  function getChildren(oControl, bAlwaysReturnAList){
@@ -127,7 +127,7 @@ sap.ui.define([
127
127
  return oControl.getBlocks().concat(oControl.getMoreBlocks());
128
128
  }
129
129
  if (isControlOfType("sap/ui/comp/smartform/Group", oControl)){
130
- return oControl.getFormElements();
130
+ return oControl.getFormElements();
131
131
  }
132
132
  if (isControlOfType("sap/ui/table/Column", oControl)){
133
133
  var aRet = oControl.getMultiLabels();
@@ -135,11 +135,11 @@ sap.ui.define([
135
135
  if (oLabel){
136
136
  aRet.push(oLabel);
137
137
  }
138
- return aRet;
139
- }
138
+ return aRet;
139
+ }
140
140
  return bAlwaysReturnAList ? [] : null;
141
141
  }
142
-
142
+
143
143
  // Sorter that compares the position of two child controls which have a common parent.
144
144
  // Returns a positive integer when oChild1 is larger, a negative number if oChild2 is larger, and 0 if they are identical.
145
145
  // Depends on getChildren() being implemented for commonParent. If this is not the case, at least a reproducable order is guaranteed.
@@ -160,13 +160,13 @@ sap.ui.define([
160
160
  }
161
161
  if (iPositionCompare & Node.DOCUMENT_POSITION_FOLLOWING){
162
162
  return -1;
163
- }
163
+ }
164
164
  }
165
165
  return 1 - 2 * (!oDomRef1 === !oDomRef2 ? oChild1.getId() < oChild2.getId() : !oDomRef2); // if we cannot determine a reasonable order we still want to have a reproducable order. Note that elements with DomRef must clearly be separated from those without.
166
166
  }
167
167
  return (iPos1 >= 0 && iPos2 >= 0) ? (iPos1 - iPos2) : (iPos2 - iPos1); // if only one child has been identified in the list of children it takes precedence.
168
168
  }
169
-
169
+
170
170
  // This function defines which instances of sap.ui.core.Element are relevant for investigation (Currently used in fnSearchInTree).
171
171
  // They must posess a property 'visible' (which is guaranteed for all instances of sap.ui.core.Control) which is true.
172
172
  // If they have a property 'enabled' this must be true as well.
@@ -176,7 +176,7 @@ sap.ui.define([
176
176
  return checkForRelevance(oCell);
177
177
  }) : (typeof oElement.getVisible === "function" && oElement.getVisible() && (typeof oElement.getEnabled !== "function" || oElement.getEnabled()));
178
178
  }
179
-
179
+
180
180
  // This function allows a depth-first search in an element tree starting with root oElement
181
181
  // Thereby, the following logic is applied
182
182
  // - Children of an element are determined by function getChildren in this class. If this provides an empty array method findElements of the element is used
@@ -188,14 +188,14 @@ sap.ui.define([
188
188
  // Note that mAlreadyAnalyzed will be updated by this function
189
189
  // fnHandleElement(oElement) is a function that will be called on all relevant elements of the tree.
190
190
  // This function can work asynchronously (i.e. return a Promise) or synchronously (i.e. return something which is not a Promise) on a case-by-case basis.
191
- // In the second case the return value will be considered as the result of the function. In the first case the value the Promise resolves to will be considered as the result.
191
+ // In the second case the return value will be considered as the result of the function. In the first case the value the Promise resolves to will be considered as the result.
192
192
  // If the result is a truthy value for one element this value is considered as the result of fnSearchInTree and the processing is stopped.
193
193
  // fnSearchInTree returns this result synchronously if all calls of fnHandleElement which have been performed until then have worked synchronously.
194
194
  // If the result of fnHandleElement is faulty the depth-first search of the tree proceeds. Thereby the processing of the subtree of oElement is
195
195
  // skipped if the result was exactly false. For other faulty values the subtree will be processed next.
196
196
  // Note that this process will never work on two elements in parallel. If the processing of one element is asynchronous the process is interrupted until
197
197
  // the result of this step is available. Only then the next element will be analyzed.
198
- // If fnHandleElement never results in a truthy value then fnSearchInTree results in null.
198
+ // If fnHandleElement never results in a truthy value then fnSearchInTree results in null.
199
199
  function fnSearchInTree(mAlreadyAnalyzed, oElement, fnHandleElement){
200
200
  mAlreadyAnalyzed = mAlreadyAnalyzed || Object.create(null);
201
201
  var sId = oElement.getId();
@@ -213,7 +213,7 @@ sap.ui.define([
213
213
  if (!aChildren){ // if getChildren does not care for the control type of oElement
214
214
  aChildren = oElement.findElements(false);
215
215
  aChildren.sort(fnSortChildControls.bind(null, oElement));
216
- }
216
+ }
217
217
  aChildren.some(function(oChild){
218
218
  vResult = fnSearchInTree(mAlreadyAnalyzed, oChild, fnHandleElement);
219
219
  return vResult; // If vResult is truthy it is either a Promise (which makes the processing asynchronous) or the result of fnSearchInTree. In both cases we should stop now.
@@ -233,12 +233,12 @@ sap.ui.define([
233
233
  }
234
234
  // When coming here we have synchronously either found a node with a truthy result or have processed the whole tree without finding any truthy result
235
235
  mAlreadyAnalyzed[sId] = 2;
236
- return vResult || null;
236
+ return vResult || null;
237
237
  }
238
238
 
239
239
  /**
240
240
  * Returns the selection plugin for the given UI table
241
- * @param {sap.ui.table.Table} oUiTable
241
+ * @param {sap.ui.table.Table} oUiTable
242
242
  * @returns {sap.ui.table.plugins.MultiSelectionPlugin|undefined}
243
243
  */
244
244
  function fnGetSelectionPluginForUITable (oUiTable) {
@@ -286,10 +286,10 @@ sap.ui.define([
286
286
  searchInTree: fnSearchInTree.bind(null, null),
287
287
  getSelectionPluginForUITable: fnGetSelectionPluginForUITable
288
288
  };
289
-
289
+
290
290
  oControlHelper.isTable = function(oControl){
291
291
  return oControlHelper.isSmartTable(oControl) || oControlHelper.isUiTable(oControl) || oControlHelper.isMTable(oControl);
292
292
  };
293
-
293
+
294
294
  return oControlHelper;
295
295
  });
@@ -2,67 +2,35 @@ sap.ui.define([
2
2
  ], function() {
3
3
  "use strict";
4
4
 
5
- function DynamicPageWrapper(vTarget) {
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
- if (oDynamicPage) {
21
- var oControlState = {};
22
- oControlState.headerPinned = oDynamicPage.getHeaderPinned();
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
- // Store the state till the control is initialized
31
- oPreliminaryState = oState;
32
- oControlAssignedPromise.then(function() {
33
- if (oPreliminaryState && oPreliminaryState.headerPinned) {
34
- // 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.
35
- oDynamicPage.setHeaderExpanded(true);
36
- oDynamicPage.setHeaderPinned(true);
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
- oControlAssignedPromise.then(function() {
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
- return {
59
- getState: fnGetState,
60
- setState: fnSetState,
61
- setControl: fnSetControl,
62
- attachStateChanged: fnAttachStateChanged,
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(vTarget) {
6
- var oObjectPageLayout, oControlAssignedResolve, oPreliminaryState;
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
- oPreliminaryState = oState;
29
- oControlAssignedPromise.then(function() {
30
- if (oPreliminaryState && oPreliminaryState.headerPinned) {
31
- oObjectPageLayout.setHeaderContentPinned(true);
32
- } else {
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
- oControlAssignedPromise.then(function() {
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
+ });