@sapui5/sap.suite.ui.generic.template 1.108.48 → 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.
Files changed (27) 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/ListReport/controller/ControllerImplementation.js +15 -9
  4. package/src/sap/suite/ui/generic/template/ListReport/controller/IappStateHandler.js +18 -9
  5. package/src/sap/suite/ui/generic/template/ListReport/view/fragments/SmartChart.fragment.xml +3 -2
  6. package/src/sap/suite/ui/generic/template/ListReport/view/fragments/SmartTable.fragment.xml +2 -1
  7. package/src/sap/suite/ui/generic/template/ObjectPage/controller/ControllerImplementation.js +4 -1
  8. package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_pt.properties +1 -1
  9. package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_sh.properties +1 -1
  10. package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_sr.properties +1 -1
  11. package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/SmartChart.fragment.xml +1 -0
  12. package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/SmartTable.fragment.xml +2 -1
  13. package/src/sap/suite/ui/generic/template/genericUtilities/ControlStateWrapperFactory.js +102 -68
  14. package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/DynamicPageWrapper.js +19 -51
  15. package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/ObjectPageLayoutWrapper.js +10 -32
  16. package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/PreliminaryWrapper.js +144 -0
  17. package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SearchFieldWrapper.js +8 -30
  18. package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartFilterBarWrapper.js +76 -99
  19. package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartTableChartCommon.js +105 -91
  20. package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartTableWrapper.js +10 -2
  21. package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartVariantManagementWrapper.js +83 -76
  22. package/src/sap/suite/ui/generic/template/js/AnnotationHelperStreamSupport.js +25 -6
  23. package/src/sap/suite/ui/generic/template/lib/AppComponent.js +1 -1
  24. package/src/sap/suite/ui/generic/template/lib/CommonUtils.js +5 -5
  25. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_zh_CN.properties +1 -1
  26. package/src/sap/suite/ui/generic/template/lib/navigation/NavigationController.js +4 -4
  27. package/src/sap/suite/ui/generic/template/library.js +1 -1
@@ -4,47 +4,71 @@ sap.ui.define([
4
4
 
5
5
  /**
6
6
  * Constructor for SmartTableChartCommon
7
- * ...
8
- * @param {object} mParams
9
- * @param mParams.oCustomFiltersWrapper - wrapper for custom filters (from SFB point of view)
10
- * (currently containing: generic (currently only editState), app extension, and adaptation extension - but this is knowledge of LR, i.e. of iAppStateHandler, not of SFB)
11
- * @returns
7
+ * @param {sap.ui.core.Control} oControl - The SmartTable or SmartChart control
8
+ * @param {object} oController - The controller instance
9
+ * @param {object} oFactory - The ControlStateWrapperFactory instance
10
+ * @param {string} sInitializationEvent - The initialization event name (e.g., "initialise")
11
+ * @param {object} [mExtensions] - Optional extension functions for control-specific state handling
12
+ * @param {function} [mExtensions.fnExtendGetUiState] - Function to extend UiState during getState
13
+ * Called with (oStateUiState, oControlUiState) where modifications to oStateUiState add to the state
14
+ * @param {function} [mExtensions.fnExtendSetUiState] - Function to extend UiState during setState
15
+ * Called with (oStateUiState, oControlUiState) where oStateUiState contains the state to apply
16
+ * @returns {object}
12
17
  */
13
18
 
14
- // deals with state of SFB itself, without SVM (see SmartVariantManagementWrapper) and go-button
19
+ // deals with state of SFB itself, without SVM (see SmartVariantManagementWrapper) and go-button
15
20
  // (does not contain a state from SFB point of view - however, we remember whether it was pressed once
16
21
  // to restore data - this information is not considered being part of SFB)
17
- function SmartTableChartCommon(vTarget, oController, oFactory, sInitializationEvent) {
18
- var oSmartControl, oVariantManagementControl, bVariantManagementActive;
19
- var oControlAssignedResolve, oPreliminaryState, bSmartControlInitialized;
22
+ function SmartTableChartCommon(oControl, oController, oFactory, sInitializationEvent, mExtensions) {
23
+ var oSmartControl = oControl;
24
+ var oVariantManagementControl, bVariantManagementActive;
20
25
  var oSmartControlStateWrapper;
21
26
  var oVariantManagementStateWrapper;
27
+ var oVariantManagementInitializedResolve;
28
+ var fnResolveReady;
22
29
 
23
- var oControlAssignedPromise = new Promise(function (resolve) {
24
- oControlAssignedResolve = resolve;
30
+ var oVariantManagementInitializedPromise = new Promise(function(resolve){
31
+ oVariantManagementInitializedResolve = resolve;
25
32
  });
26
33
 
27
- if (typeof vTarget !== "string") {
28
- fnSetControl(vTarget);
34
+ var oReadyPromise = new Promise(function(resolve) {
35
+ fnResolveReady = resolve;
36
+ });
37
+
38
+ // Initialize control state wrapper and check if control is already initialized
39
+ oSmartControlStateWrapper = getControlWrapper(oSmartControl);
40
+ if (!oSmartControl.isInitialised()) {
41
+ // In case Smart Chart/Table is not yet initialized
42
+ // listen to the initialize event & then initialize the wrapper
43
+ oSmartControl.attachEvent(sInitializationEvent, fnControlInitialized);
44
+ } else {
45
+ fnControlInitialized();
29
46
  }
30
47
 
31
48
  // creates a simple wrapper for a SmartTable or SmartChart (a control using UIState) (ignoring initialization and vm)
32
49
  function getControlWrapper(oControl) {
33
50
  var bIsApplying = false; // avoid forwarding change event when caused by us applying a state
34
51
  function fnGetState() {
35
- var oUiState = oControl.getUiState(); // unfortunately not serializable, but a managed object
52
+ var oControlUiState = oControl.getUiState(); // unfortunately not serializable, but a managed object
53
+ var oStateUiState = {
54
+ oPresentationVariant: oControlUiState.getPresentationVariant(),
55
+ oSelectionVariant: oControlUiState.getSelectionVariant()
56
+ };
57
+
58
+ // Allow extension to add control-specific properties (e.g., tableSettings for SmartTable)
59
+ if (mExtensions && mExtensions.fnExtendGetUiState) {
60
+ mExtensions.fnExtendGetUiState(oStateUiState, oControlUiState);
61
+ }
62
+
36
63
  return {
37
- oUiState: {
38
- oPresentationVariant: oUiState.getPresentationVariant(),
39
- oSelectionVariant: oUiState.getSelectionVariant()
40
- }
64
+ oUiState: oStateUiState
41
65
  };
42
66
  }
43
67
 
44
68
  function fnSetState(oState) {
45
69
  if (oState) {
46
70
  if (!oState.oUiState) {
47
- // Legacy handling for state without additional level oUiState (created with 1.99.0 - 1.99.3). Could be relevant on LR and OP, and independent of VM
71
+ // Legacy handling for state without additional level oUiState (created with 1.99.0 - 1.99.3). Could be relevant on LR and OP, and independent of VM
48
72
  oState = {
49
73
  oUiState: oState
50
74
  };
@@ -52,11 +76,17 @@ sap.ui.define([
52
76
  bIsApplying = true;
53
77
  // don't create UiState (managed object) from scratch, but fetch it from control and only apply known properties from state - thus, if any other properties would be added, we don't
54
78
  // interfere with them
55
- var oUiState = oControl.getUiState();
56
- if (!oUiState.getProperty("variantName")){
57
- oUiState.setPresentationVariant(oState.oUiState.oPresentationVariant);
58
- oUiState.setSelectionVariant(oState.oUiState.oSelectionVariant);
59
- oControl.setUiState(oUiState);
79
+ var oControlUiState = oControl.getUiState();
80
+ if (!oControlUiState.getProperty("variantName")){
81
+ oControlUiState.setPresentationVariant(oState.oUiState.oPresentationVariant);
82
+ oControlUiState.setSelectionVariant(oState.oUiState.oSelectionVariant);
83
+
84
+ // Allow extension to set control-specific properties (e.g., tableSettings for SmartTable)
85
+ if (mExtensions && mExtensions.fnExtendSetUiState) {
86
+ mExtensions.fnExtendSetUiState(oState.oUiState, oControlUiState);
87
+ }
88
+
89
+ oControl.setUiState(oControlUiState);
60
90
  }
61
91
  bIsApplying = false;
62
92
  } else {
@@ -82,71 +112,59 @@ sap.ui.define([
82
112
  getState: fnGetState,
83
113
  setState: fnSetState,
84
114
  getLocalId: fnGetLocalId,
85
- bVMConnection: false,
86
- attachStateChanged: fnAttachStateChanged
115
+ bVMConnection: oControl && oControl.getSmartVariant && !!oControl.getSmartVariant(),
116
+ attachStateChanged: fnAttachStateChanged,
117
+ onAfterVariantInitialise: oVariantManagementInitializedResolve
87
118
  };
88
119
  }
89
120
 
90
121
  function fnGetState() {
91
- if (bSmartControlInitialized) {
92
- if (oVariantManagementStateWrapper) {
93
- // oVariantManagementStateWrapper would be undefined only in cases SmartControl is not yet initialized
94
- // or VariantManagement is not enabled.
95
- return oVariantManagementStateWrapper.getState();
96
- }
97
-
98
- if (oSmartControlStateWrapper && !bVariantManagementActive) {
99
- // VariantManagement is not turned on & SmartControlStateWrapper instance
100
- return oSmartControlStateWrapper.getState();
101
- }
122
+ if (oVariantManagementStateWrapper) {
123
+ // Variant management is active
124
+ return oVariantManagementStateWrapper.getState();
102
125
  }
103
-
104
- // Control is not available and StateWrapper is not initialized
105
- return oPreliminaryState;
126
+
127
+ // No variant management - return control state directly
128
+ return oSmartControlStateWrapper.getState();
106
129
  }
107
130
 
108
131
  function fnSetState(oState) {
109
- oPreliminaryState = oState;
110
- oControlAssignedPromise.then(function () {
111
- // map legacy states - before separating VM state from state of managed control, inner state information
112
- // (presentation variant and selection variant) were put as oUiState on the same level as VM state
113
- // information (variant id and dirty indicator), now they are contained in map managedControlStates
114
- if (oState && oState.oUiState && !oState.managedControlStates){
115
- oState.managedControlStates = Object.create(null);
116
- oState.managedControlStates[oSmartControlStateWrapper.getLocalId()] = {oUiState: oState.oUiState};
117
- oState.modified = oState.bVariantModified;
118
- oState.variantId = oState.sVariantId;
119
- }
120
-
132
+ if (!oState) {
133
+ // If no state provided, set standard variant on control
121
134
  if (bVariantManagementActive) {
122
- // In case VariantManagement is configured
123
- oVariantManagementStateWrapper.setState(oPreliminaryState);
124
- return;
135
+ oVariantManagementStateWrapper.setState(oState);
136
+ } else {
137
+ oSmartControlStateWrapper.setState(oState);
125
138
  }
126
-
127
- // SmartTable/Chart shall be used
128
- oSmartControlStateWrapper.setState(oPreliminaryState);
129
- });
130
- }
131
-
132
- function fnSetControl(oControl) {
133
- oSmartControl = oControl;
134
- oSmartControlStateWrapper = getControlWrapper(oSmartControl);
135
- if (!oSmartControl.isInitialised()) {
136
- // In case Smart Chart/Table is not yet initialized
137
- // listen to the initialize event & then resolve the control
138
- oSmartControl.attachEvent(sInitializationEvent, fnControlInitialized);
139
139
  return;
140
140
  }
141
141
 
142
- fnControlInitialized();
142
+ // Map legacy states - before separating VM state from state of managed control, inner state information
143
+ // (presentation variant and selection variant) were put as oUiState on the same level as VM state
144
+ // information (variant id and dirty indicator), now they are contained in map managedControlStates
145
+ if (oState.oUiState && !oState.managedControlStates) {
146
+ oState.managedControlStates = Object.create(null);
147
+ oState.managedControlStates[oSmartControlStateWrapper.getLocalId()] = {oUiState: oState.oUiState};
148
+ }
149
+ if (oState.bVariantModified !== undefined) {
150
+ oState.modified = oState.bVariantModified;
151
+ }
152
+ if (oState.sVariantId !== undefined) {
153
+ oState.variantId = oState.sVariantId;
154
+ }
155
+
156
+ if (bVariantManagementActive) {
157
+ // In case VariantManagement is configured
158
+ oVariantManagementStateWrapper.setState(oState);
159
+ } else {
160
+ // SmartTable/Chart shall be used
161
+ oSmartControlStateWrapper.setState(oState);
162
+ }
143
163
  }
144
164
 
145
165
  function fnControlInitialized() {
146
- bSmartControlInitialized = true;
147
-
148
166
  // deal with VM
149
- // 3 possibilties with respect to VM
167
+ // 3 possibilities with respect to VM
150
168
  // a) no VM (relevant for this control) at all
151
169
  // b) control managed as part of page wide variant management
152
170
  // c) control creates own VM
@@ -155,7 +173,7 @@ sap.ui.define([
155
173
  // in each case) -thus, we better create and return a vm wrapper here, passing the inner wrapper (the same, we would create in the other cases).
156
174
  // Additionally, this simplifies the adaptation to the change of format (formerly, variant data and control data were mixed on same level)
157
175
 
158
- // to identify the situation, check properties smartVariant and useVariantManagement. (In LR/ALP, we could directly check component settings controlling these properties, but not
176
+ // to identify the situation, check properties smartVariant and useVariantManagement. (In LR/ALP, we could directly check component settings controlling these properties, but not
159
177
  // in OP, as they could be different per section. Checking control's properties would also incorporate UI changes, however, these properties are anyway not allowed to be changed.)
160
178
  // values: smartVariant useVariantManagement
161
179
  // a) null false on LR currently: truthy (id of VM) and true - but PageVM is not created, and thus being ignored => adapt how properties are set in xml
@@ -170,39 +188,35 @@ sap.ui.define([
170
188
  oVariantManagementStateWrapper = oFactory.getControlStateWrapper(oVariantManagementControl, {
171
189
  managedControlWrappers: [ oSmartControlStateWrapper ]
172
190
  });
173
- oControlAssignedResolve();
191
+ fnResolveReady();
174
192
  } else {
175
- // Resolve the ControlAssignedPromise only once the VariantManagement is
176
- // also initialized
193
+ // Wait for VariantManagement to be initialized
177
194
  oSmartControl.attachAfterVariantInitialise(fnControlInitialized);
178
195
  }
179
-
180
- return;
196
+ } else {
197
+ // No variant management or page-level variant management - ready immediately
198
+ fnResolveReady();
181
199
  }
182
- // There is no VariantManagement configured for this SmartChart/SmartTable
183
- oControlAssignedResolve(oSmartControl);
184
200
  }
185
201
 
186
202
  function fnAttachStateChanged(fnHandler) {
187
- oControlAssignedPromise.then(function () {
188
- if (bVariantManagementActive) {
189
- oVariantManagementStateWrapper.attachStateChanged(fnHandler);
190
- return;
191
- }
192
-
203
+ if (bVariantManagementActive) {
204
+ oVariantManagementStateWrapper.attachStateChanged(fnHandler);
205
+ } else {
193
206
  oSmartControlStateWrapper.attachStateChanged(fnHandler);
194
-
195
- });
207
+ }
196
208
  }
197
209
 
198
210
  return {
199
211
  getState: fnGetState,
200
212
  setState: fnSetState,
201
- setControl: fnSetControl,
202
213
  attachStateChanged: fnAttachStateChanged,
203
- bVMConnection: oSmartControl && oSmartControl.getSmartVariant && !!oSmartControl.getSmartVariant()
214
+ bVMConnection: oSmartControl && oSmartControl.getSmartVariant && !!oSmartControl.getSmartVariant(),
215
+ oVariantManagementInitializedPromise: oVariantManagementInitializedPromise,
216
+ onAfterVariantInitialise: oVariantManagementInitializedResolve,
217
+ oReadyPromise: oReadyPromise
204
218
  };
205
219
  }
206
220
 
207
221
  return SmartTableChartCommon;
208
- });
222
+ });
@@ -2,10 +2,18 @@ sap.ui.define([
2
2
  "sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartTableChartCommon"
3
3
  ], function(SmartTableChartCommon) {
4
4
  "use strict";
5
-
5
+
6
+ /**
7
+ * Constructor for SmartTableWrapper
8
+ * @param {sap.ui.comp.smarttable.SmartTable} oSmartTable - The SmartTable control
9
+ * @param {object} oController - The controller instance
10
+ * @param {object} oFactory - The ControlStateWrapperFactory instance
11
+ * @returns {object} Wrapper object for SmartTable
12
+ */
6
13
  function SmartTableWrapper(oSmartTable, oController, oFactory){
14
+ // SmartTable extends SmartTableChartCommon with tableSettings support
7
15
  return new SmartTableChartCommon(oSmartTable, oController, oFactory, "initialise");
8
16
  }
9
17
 
10
18
  return SmartTableWrapper;
11
- });
19
+ });
@@ -4,18 +4,16 @@ sap.ui.define([
4
4
 
5
5
  /**
6
6
  * Constructor for SmartVariantManagementWrapper
7
- * @param {sap.ui.comp.smartvariants.SmartVariantManagement} vTarget - The SmartVariantManagement control
8
- * or the Id of control for which this wrapper is created
7
+ * @param {sap.ui.comp.smartvariants.SmartVariantManagement} oControl - The SmartVariantManagement control
9
8
  * @param {object} oController - the controller of the current component
10
9
  * @param {object} oFactory - the controlStateWrapperFactory
11
10
  * @param {object} mParams
12
11
  * @param mParams.managedControlWrappers - array of controlStateWrappers for controls handled by the SVM
13
12
  * (currently also including SFB wrapper - to be removed)
14
- * @param mParams.dynamicPageWrapper - dynamicPageWrapper instance handled by SVM
15
- * @returns
13
+ * @returns {object}
16
14
  */
17
15
 
18
- function SmartVariantManagementWrapper(vTarget, oController, oFactory, mParams) {
16
+ function SmartVariantManagementWrapper(oControl, oController, oFactory, mParams) {
19
17
  // Special handling of SmartFilterBarWrapper for several reasons:
20
18
  // - Suppress selection when restoring a variant. Selection is solely triggered according to information in appState. Otherwise, erroneous selection could be triggered in
21
19
  // a few situations:
@@ -26,14 +24,10 @@ sap.ui.define([
26
24
  // - Store and restore extension state (extension implemented in SFB instead of SVM, which would be more appropriate from architectural point of view)
27
25
  // flag to control whether we are currently in the process of applying a state to suppress the event to inform about a new state´
28
26
  // only needed when setting the variant itself - for managed controls, their wrappers should avoid firing the event themselves
29
- var oSmartVariantManagement, fnResolveControlAssigned, oPreliminaryState;
30
- var oControlAssignedPromise = new Promise(function (resolve) {
31
- fnResolveControlAssigned = resolve;
32
- });
33
-
34
- if (typeof vTarget !== "string") {
35
- fnSetControl(vTarget);
36
- }
27
+ var oSmartVariantManagement = oControl;
28
+ var oPreliminaryState;
29
+ var bIsApplyingVariant = false;
30
+ var bAllControlsInitialized = false;
37
31
 
38
32
  // Handles the state of the variant management itself (i.e. which variant is selected and whether it's dirty), including the state of the managed controls.
39
33
  // Is responsible esp. to restore this state with correct dependency resp. in correct order
@@ -50,69 +44,72 @@ sap.ui.define([
50
44
  // For these controls, a real user changes are already handled by the direct connection. On the other hand, these controls also fire their change events, if their state is
51
45
  // changed from SVM (by the same connection) - setting variant dirty here would be wrong.
52
46
  mParams.managedControlWrappers.forEach(function(oWrapper){
53
- if (!oWrapper.bVMConnection){
54
- oWrapper.attachStateChanged(function(){
55
- oSmartVariantManagement.currentVariantSetModified(true);
56
- });
57
- }
47
+ (oWrapper.oVMConnectionPromise || Promise.resolve(oWrapper.bVMConnection)).then(function(bVMConnection) {
48
+ if (!bVMConnection) {
49
+ oWrapper.attachStateChanged(function(){
50
+ oSmartVariantManagement.currentVariantSetModified(true);
51
+ });
52
+ }
53
+ });
58
54
  });
59
55
 
60
56
 
61
57
 
62
- function fnSetControl(oControl) {
63
- oSmartVariantManagement = oControl;
64
- fnResolveControlAssigned(oSmartVariantManagement);
65
- }
66
-
67
58
  var oSmartFilterBarWrapper = mParams.managedControlWrappers.find(function(oWrapper){
68
59
  return oWrapper.setSVMWrapperCallbacks;
69
60
  });
70
61
 
71
- // provide callbacks needed for SFB wrapper to store/restore extnesion state with variant
62
+ // provide callbacks needed for SFB wrapper to store/restore extension state with variant
72
63
  if (oSmartFilterBarWrapper){
73
- oSmartFilterBarWrapper.setSVMWrapperCallbacks({
74
- getManagedControlStates: function(){
75
- var mManagedControlStates = Object.create(null);
76
- mParams.managedControlWrappers.forEach(function(oWrapper){
77
- if (!oWrapper.bVMConnection){
78
- mManagedControlStates[oWrapper.getLocalId()] = oWrapper.getState();
79
- }
80
- });
81
- return mManagedControlStates;
82
- },
83
- setManagedControlStates: function(oState){
84
- mParams.managedControlWrappers.forEach(function(oWrapper){
85
- if (!oWrapper.bVMConnection){
86
- oWrapper.setState(oState[oWrapper.getLocalId()]);
87
- }
88
- });
89
- },
90
- setHeaderState: function(bHeaderToBeExpanded) {
91
- mParams.dynamicPageWrapper.setHeaderState(oController, bHeaderToBeExpanded);
92
- }
64
+ // Build array with wrapper + bVMConnection info once all wrappers are ready
65
+ Promise.all(mParams.managedControlWrappers.map(function(oWrapper){
66
+ return (oWrapper.oVMConnectionPromise || Promise.resolve(oWrapper.bVMConnection)).then(function(bVMConnection){
67
+ return {
68
+ wrapper: oWrapper,
69
+ bVMConnection: bVMConnection
70
+ };
71
+ });
72
+ })).then(function(aWrapperInfo) {
73
+ oSmartFilterBarWrapper.setSVMWrapperCallbacks({
74
+ getManagedControlStates: function(){
75
+ var mManagedControlStates = Object.create(null);
76
+ aWrapperInfo.forEach(function(oInfo){
77
+ if (!oInfo.bVMConnection) {
78
+ mManagedControlStates[oInfo.wrapper.getLocalId()] = oInfo.wrapper.getState();
79
+ }
80
+ });
81
+ return mManagedControlStates;
82
+ },
83
+ setManagedControlStates: function(oState){
84
+ aWrapperInfo.forEach(function(oInfo){
85
+ if (!oInfo.bVMConnection) {
86
+ oInfo.wrapper.setState(oState[oInfo.wrapper.getLocalId()]);
87
+ }
88
+ });
89
+ }
90
+ });
93
91
  });
94
92
  }
95
93
 
94
+ // Create promise that resolves when all managed controls' variant management is ready
95
+ // This ensures getState() can query controls even if setState() is never called (e.g., app starts from scratch)
96
+ var oAllControlsInitializedPromise = Promise.all(
97
+ mParams.managedControlWrappers.map(function(oWrapper){
98
+ return oWrapper.oVariantManagementInitializedPromise || Promise.resolve();
99
+ })
100
+ );
101
+
102
+ // Set flag when all controls are initialized
103
+ oAllControlsInitializedPromise.then(function() {
104
+ bAllControlsInitialized = true;
105
+ });
106
+
96
107
  // Wrapper is intended to set a state to the ui, but not to trigger a selection (which should happen only after all (relevant) parts of ui state is set to the correct state
97
108
  // are set correct. Therefore, setting variant from here should never trigger a selection.
98
109
  function fnSetVariant(sVariantId){
99
110
  if (oSmartFilterBarWrapper){
100
111
  oSmartFilterBarWrapper.suppressSelection(true);
101
112
  }
102
- var sId = mParams.managedControlWrappers[0].getLocalId();
103
- var oControl = oController.getView().byId(sId);
104
- if (oControl && oControl.isA("sap.ui.comp.smarttable.SmartTable")) {
105
- oControl.attachAfterVariantInitialise(function() {
106
- //set currentVariantId only when sVariantId is not standard (as it might be overriding existing
107
- //different currentVariantId) or smartTable's (oControl) currentVariantId is not equal to sVariantId.
108
- if (sVariantId !== '*standard*' && sVariantId !== '') {
109
- if (oControl.getCurrentVariantId && oControl.getCurrentVariantId() !== sVariantId) {
110
- oControl.setCurrentVariantId(sVariantId);
111
- }
112
- oSmartVariantManagement.setModified(false);
113
- }
114
- });
115
- }
116
113
  oSmartVariantManagement.setCurrentVariantId(sVariantId);
117
114
  if (oSmartFilterBarWrapper){
118
115
  oSmartFilterBarWrapper.suppressSelection(false);
@@ -133,7 +130,11 @@ sap.ui.define([
133
130
  }
134
131
 
135
132
  function getState() {
136
- if (!oSmartVariantManagement) {
133
+ // Return preliminary state if managed controls not fully initialized
134
+ // Note: If early getState() calls become an issue (controls not initialized yet), we could enhance this to:
135
+ // - Store only SVM-specific data (variantId, modified) in oPreliminaryState
136
+ // - Always query managed control wrappers directly (they handle their own preliminary state via PreliminaryWrapper)
137
+ if (!bAllControlsInitialized) {
137
138
  return oPreliminaryState;
138
139
  }
139
140
 
@@ -150,22 +151,23 @@ sap.ui.define([
150
151
 
151
152
  function setState(oState) {
152
153
  oPreliminaryState = oState;
153
- oControlAssignedPromise.then(function() {
154
+
155
+ // Wait for all managed controls to be initialized before applying state
156
+ oAllControlsInitializedPromise.then(function() {
157
+ bIsApplyingVariant = true;
154
158
  if (!oPreliminaryState) {
155
159
  // if no state is provided set default variant (not modified)
156
160
  // use cases:
157
161
  // - LR: if appStateKey in the URL that cannot be read
158
162
  // - OP: if switching to different object instance (in discovery mode always, in persistency mode when page was not shown)
159
163
  fnSetVariant(oSmartVariantManagement.getDefaultVariantId());
160
- return;
161
- }
162
- if (oPreliminaryState.modified) {
164
+ } else if (oPreliminaryState.modified) {
163
165
  // Special logic according to UX: If variant was modified anyway, there's no benefit for the user to see the name (but it could be confusing), so standard variant (not default!) should be
164
166
  // set (which is achieved by empty string)
165
167
  fnSetVariant("");
168
+ oSmartVariantManagement.currentVariantSetModified(true);
166
169
  // Usually restoring the state of any of the managed controls should mark the variant as dirty, but there might be edge cases (state from an old release not containing information for any
167
170
  // managed control now relevant), so to be on the safe side, we set modified=true explicitly.
168
- oSmartVariantManagement.currentVariantSetModified(true);
169
171
  fnSetManagedControlStates(oPreliminaryState);
170
172
  } else {
171
173
  fnSetVariant(oPreliminaryState.variantId);
@@ -183,6 +185,7 @@ sap.ui.define([
183
185
  }
184
186
  }
185
187
  }
188
+ bIsApplyingVariant = false;
186
189
  });
187
190
  }
188
191
 
@@ -190,26 +193,30 @@ sap.ui.define([
190
193
  // state of variant management itself can be changed directly (user selects a different variant or stores current state as (new) variant), or indirectly (user changes some
191
194
  // data of a control managed by VM, e.g. some filter values in SFB)
192
195
 
193
- oControlAssignedPromise.then(function() {
194
- // state change when user selects a different variant
195
- oSmartVariantManagement.attachSelect(fnHandler);
196
+ // Wrap the handler to suppress events when applying a variant
197
+ var fnSuppressibleHandler = function() {
198
+ if (!bIsApplyingVariant) {
199
+ fnHandler();
200
+ }
201
+ };
202
+
203
+ // state change when user selects a different variant
204
+ oSmartVariantManagement.attachSelect(fnSuppressibleHandler);
196
205
 
197
- // when user saves current state as a new variant, this is also a state change (as the variant id is part of the state)
198
- // note: Even if new (SFB) variant is marked as execute on select, and currently no data is selected, no need to select data here (and thus also not to collapse header).
199
- // This is one of the possible ways to get into a state with a clean variant with execute on select, but no data loaded - see also comment to identify SFB wrapper.
200
- oSmartVariantManagement.attachAfterSave(fnHandler);
206
+ // when user saves current state as a new variant, this is also a state change (as the variant id is part of the state)
207
+ // note: Even if new (SFB) variant is marked as execute on select, and currently no data is selected, no need to select data here (and thus also not to collapse header).
208
+ // This is one of the possible ways to get into a state with a clean variant with execute on select, but no data loaded - see also comment to identify SFB wrapper.
209
+ oSmartVariantManagement.attachAfterSave(fnSuppressibleHandler);
201
210
 
202
- // any change of a managed control is state change
203
- mParams.managedControlWrappers.forEach(function(oWrapper){
204
- oWrapper.attachStateChanged(fnHandler);
205
- });
211
+ // any change of a managed control is state change
212
+ mParams.managedControlWrappers.forEach(function(oWrapper){
213
+ oWrapper.attachStateChanged(fnSuppressibleHandler);
206
214
  });
207
215
  }
208
216
 
209
217
  return {
210
218
  getState : getState,
211
219
  setState : setState,
212
- setControl: fnSetControl,
213
220
  attachStateChanged : attachStateChanged
214
221
  };
215
222
  }
@@ -126,17 +126,36 @@ sap.ui.define([
126
126
  return sAcceptableMimeType.slice(0, -1);
127
127
  },
128
128
 
129
- getDeleteStreamVisibility: function(oInterface, oMediaType, bIsDraftEnabled, oEntitySet){
129
+ // funtion return the controlling binding path form by annotation/metadata/fieldcontrol path
130
+ getControlPath: function(oEntitySet, oFieldControl) {
131
+ var sPath = "";
132
+ var sAnnotationUpdatablePath = oEntitySet && oEntitySet["Org.OData.Capabilities.V1.UpdateRestrictions"] && oEntitySet["Org.OData.Capabilities.V1.UpdateRestrictions"]["Updatable"] && oEntitySet["Org.OData.Capabilities.V1.UpdateRestrictions"]["Updatable"].Path;
133
+ var sMetadataUpdatable = oEntitySet && (oEntitySet["sap:updatable"] || oEntitySet["sap:updatable-path"]);
134
+ if (sAnnotationUpdatablePath || sMetadataUpdatable) {
135
+ sPath = '${' + (sAnnotationUpdatablePath || sMetadataUpdatable) + '} !== false';
136
+ }
137
+ if (oFieldControl) {
138
+ var sFCPath = oFieldControl && oFieldControl.Path;
139
+ sPath += ' && ${' + sFCPath + '} > "1"';
140
+ }
141
+ return sPath;
142
+ },
143
+
144
+ getDeleteStreamVisibility: function (oInterface, oMediaType, bIsDraftEnabled, oEntitySet) {
130
145
  var oEntityType = oEntitySet && oInterface.getModel(0).getODataEntityType(oEntitySet.entityType);
131
- var sFCPath = oEntityType && oEntityType["com.sap.vocabularies.Common.v1.FieldControl"] && oEntityType["com.sap.vocabularies.Common.v1.FieldControl"].Path;
146
+ var oFieldControl = oEntityType && oEntityType["com.sap.vocabularies.Common.v1.FieldControl"];
147
+ if (oFieldControl && oFieldControl.EnumMember === "com.sap.vocabularies.Common.v1.FieldControlType/ReadOnly") {
148
+ return false;
149
+ }
150
+ var sPath = oAnnotationHelperStreamSupport.getControlPath(oEntitySet, oFieldControl);
132
151
  if (bIsDraftEnabled) {
133
- return sFCPath ? '{= ${' + oMediaType + '} !== "" && ${ui>/editable} && ${' + sFCPath + '} > "1"}' : '{= ${' + oMediaType + '} !== "" && ${ui>/editable}}';
152
+ return sPath ? '{= ${' + oMediaType + '} !== "" && ${ui>/editable} && ' + sPath + '}' : '{= ${' + oMediaType + '} !== "" && ${ui>/editable}}';
134
153
  } else {
135
- return sFCPath ? '{= ${' + oMediaType + '} !== "" && !${ui>/editable} && ${' + sFCPath + '} > "1"}' : '{= ${' + oMediaType + '} !== "" && !${ui>/editable}}';
154
+ return sPath ? '{= ${' + oMediaType + '} !== "" && !${ui>/editable} && ' + sPath + '}' : '{= ${' + oMediaType + '} !== "" && !${ui>/editable}}';
136
155
  }
137
156
  },
138
157
 
139
- getFileUploaderVisibility: function(oInterface, bIsDraftEnabled, oEntitySet){
158
+ getFileUploaderVisibility: function (oInterface, bIsDraftEnabled, oEntitySet) {
140
159
  var oEntityType = oEntitySet && oInterface.getModel(1).getODataEntityType(oEntitySet.entityType);
141
160
  var sFCPath = oEntityType && oEntityType["com.sap.vocabularies.Common.v1.FieldControl"] && oEntityType["com.sap.vocabularies.Common.v1.FieldControl"].Path;
142
161
  var bRestrictions = AnnotationHelper.getUpdateRestrictions(oEntitySet);
@@ -157,7 +176,7 @@ sap.ui.define([
157
176
  }
158
177
  }
159
178
  }
160
- };
179
+ };
161
180
 
162
181
  oAnnotationHelperStreamSupport.checkIfEntityOrAssociationHasStreamEnabled.requiresIContext = true;
163
182
  oAnnotationHelperStreamSupport.getFileName.requiresIContext = true;
@@ -856,7 +856,7 @@ sap.ui.define([
856
856
  * @extends sap.ui.core.UIComponent
857
857
  * @abstract
858
858
  * @author SAP SE
859
- * @version 1.108.48
859
+ * @version 1.108.49
860
860
  * @name sap.suite.ui.generic.template.lib.AppComponent
861
861
  */
862
862
  return UIComponent.extend("sap.suite.ui.generic.template.lib.AppComponent", {
@@ -1336,16 +1336,16 @@ sap.ui.define(["sap/ui/base/Object",
1336
1336
 
1337
1337
  function setStreamData(oStreamData, sNavigationProperty){
1338
1338
  if (oStreamData && oStreamData.__metadata){
1339
- var edit_media = oStreamData.__metadata.edit_media;
1339
+ var media_url = oStreamData.__metadata.edit_media || oStreamData.__metadata.media_src;
1340
1340
  var content_type = oStreamData.__metadata.content_type;
1341
1341
  var urlPath = "";
1342
- if (edit_media) {
1343
- if (edit_media.startsWith("http:") || edit_media.startsWith("https:")) {
1342
+ if (media_url) {
1343
+ if (media_url.startsWith("http:") || media_url.startsWith("https:")) {
1344
1344
  //To ensure code is backward compatible with older versions of SAP Gateway
1345
- var url = edit_media && new URL(edit_media);
1345
+ var url = media_url && new URL(media_url);
1346
1346
  urlPath = url && url.pathname;
1347
1347
  } else {
1348
- urlPath = edit_media;
1348
+ urlPath = media_url;
1349
1349
  }
1350
1350
  }
1351
1351
  var bIcon = IconPool.getIconForMimeType(content_type);