@openui5/sap.ui.layout 1.92.0 → 1.93.3
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/.reuse/dep5 +5 -0
- package/THIRDPARTY.txt +10 -1
- package/package.json +2 -2
- package/src/sap/ui/layout/.library +1 -1
- package/src/sap/ui/layout/AlignedFlowLayout.js +1 -1
- package/src/sap/ui/layout/AssociativeSplitter.js +1 -1
- package/src/sap/ui/layout/BlockLayout.js +1 -1
- package/src/sap/ui/layout/BlockLayoutCell.js +1 -1
- package/src/sap/ui/layout/BlockLayoutCellData.js +1 -1
- package/src/sap/ui/layout/BlockLayoutRow.js +1 -1
- package/src/sap/ui/layout/DynamicSideContent.js +1 -1
- package/src/sap/ui/layout/FixFlex.js +1 -1
- package/src/sap/ui/layout/Grid.js +1 -1
- package/src/sap/ui/layout/GridData.js +1 -1
- package/src/sap/ui/layout/GridRenderer.js +1 -1
- package/src/sap/ui/layout/HorizontalLayout.js +1 -1
- package/src/sap/ui/layout/PaneContainer.js +1 -1
- package/src/sap/ui/layout/ResponsiveFlowLayout.js +1 -1
- package/src/sap/ui/layout/ResponsiveFlowLayoutData.js +1 -1
- package/src/sap/ui/layout/ResponsiveSplitter.js +1 -1
- package/src/sap/ui/layout/ResponsiveSplitterPage.js +1 -1
- package/src/sap/ui/layout/SplitPane.js +1 -1
- package/src/sap/ui/layout/Splitter.js +2 -2
- package/src/sap/ui/layout/SplitterLayoutData.js +1 -1
- package/src/sap/ui/layout/VerticalLayout.js +1 -1
- package/src/sap/ui/layout/changeHandler/AddFormContainer.js +49 -22
- package/src/sap/ui/layout/changeHandler/AddFormField.js +40 -30
- package/src/sap/ui/layout/changeHandler/AddSimpleFormField.js +42 -27
- package/src/sap/ui/layout/changeHandler/AddSimpleFormGroup.js +76 -60
- package/src/sap/ui/layout/changeHandler/HideSimpleForm.js +166 -92
- package/src/sap/ui/layout/changeHandler/MoveSimpleForm.js +185 -141
- package/src/sap/ui/layout/changeHandler/RenameFormContainer.js +45 -35
- package/src/sap/ui/layout/changeHandler/RenameSimpleForm.js +13 -9
- package/src/sap/ui/layout/changeHandler/UnhideSimpleForm.js +64 -49
- package/src/sap/ui/layout/cssgrid/CSSGrid.js +1 -1
- package/src/sap/ui/layout/cssgrid/GridBasicLayout.js +1 -1
- package/src/sap/ui/layout/cssgrid/GridBoxLayout.js +1 -1
- package/src/sap/ui/layout/cssgrid/GridBoxLayoutStyleHelper.js +1 -1
- package/src/sap/ui/layout/cssgrid/GridItemLayoutData.js +1 -1
- package/src/sap/ui/layout/cssgrid/GridLayoutBase.js +1 -1
- package/src/sap/ui/layout/cssgrid/GridLayoutDelegate.js +1 -1
- package/src/sap/ui/layout/cssgrid/GridResponsiveLayout.js +1 -1
- package/src/sap/ui/layout/cssgrid/GridSettings.js +1 -1
- package/src/sap/ui/layout/cssgrid/ResponsiveColumnItemLayoutData.js +1 -1
- package/src/sap/ui/layout/cssgrid/ResponsiveColumnLayout.js +1 -1
- package/src/sap/ui/layout/designtime/form/SimpleForm.designtime.js +7 -2
- package/src/sap/ui/layout/form/ColumnContainerData.js +1 -1
- package/src/sap/ui/layout/form/ColumnElementData.js +1 -1
- package/src/sap/ui/layout/form/ColumnLayout.js +1 -1
- package/src/sap/ui/layout/form/Form.js +1 -1
- package/src/sap/ui/layout/form/FormContainer.js +1 -1
- package/src/sap/ui/layout/form/FormElement.js +1 -1
- package/src/sap/ui/layout/form/FormLayout.js +1 -1
- package/src/sap/ui/layout/form/GridContainerData.js +1 -1
- package/src/sap/ui/layout/form/GridElementData.js +1 -1
- package/src/sap/ui/layout/form/GridLayout.js +1 -1
- package/src/sap/ui/layout/form/ResponsiveGridLayout.js +2 -7
- package/src/sap/ui/layout/form/ResponsiveLayout.js +2 -1
- package/src/sap/ui/layout/form/SemanticFormElement.js +49 -32
- package/src/sap/ui/layout/form/SimpleForm.js +11 -9
- package/src/sap/ui/layout/library.js +3 -2
- package/src/sap/ui/layout/themes/base/ResponsiveSplitter.less +4 -2
- package/src/sap/ui/layout/themes/base/Splitter.less +1 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
sap.ui.define([
|
|
8
8
|
"sap/ui/fl/changeHandler/Base",
|
|
9
|
-
"sap/ui/
|
|
9
|
+
"sap/ui/core/util/reflection/JsControlTreeModifier",
|
|
10
10
|
"sap/base/Log"
|
|
11
11
|
], function (
|
|
12
12
|
Base,
|
|
@@ -19,7 +19,7 @@ sap.ui.define([
|
|
|
19
19
|
* Change handler for adding a simple form group.
|
|
20
20
|
* @alias sap.ui.layout.changeHandler.AddSimpleFormGroup
|
|
21
21
|
* @author SAP SE
|
|
22
|
-
* @version 1.
|
|
22
|
+
* @version 1.93.3
|
|
23
23
|
* @experimental Since 1.27.0
|
|
24
24
|
*/
|
|
25
25
|
var AddSimpleFormGroup = {};
|
|
@@ -27,16 +27,25 @@ sap.ui.define([
|
|
|
27
27
|
AddSimpleFormGroup.CONTENT_AGGREGATION = "content";
|
|
28
28
|
|
|
29
29
|
var fnFirstGroupWithoutTitle = function(oModifier, aStopToken, aContent) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
return aContent.reduce(function(oPreviousPromise, oContent){
|
|
31
|
+
return oPreviousPromise
|
|
32
|
+
.then(function(bReturnValue){
|
|
33
|
+
if (bReturnValue !== undefined) {
|
|
34
|
+
return bReturnValue;
|
|
35
|
+
}
|
|
36
|
+
var sType = oModifier.getControlType(oContent);
|
|
37
|
+
if (aStopToken.indexOf(sType) === -1) {
|
|
38
|
+
return Promise.resolve()
|
|
39
|
+
.then(oModifier.getVisible.bind(oModifier, oContent))
|
|
40
|
+
.then(function(bVisible){
|
|
41
|
+
return bVisible || undefined;
|
|
42
|
+
});
|
|
43
|
+
} else {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}, Promise.resolve());
|
|
48
|
+
|
|
40
49
|
};
|
|
41
50
|
|
|
42
51
|
var fnMapGroupIndexToContentAggregationIndex = function(oModifier, aStopToken, aContent, iGroupIndex) {
|
|
@@ -47,22 +56,24 @@ sap.ui.define([
|
|
|
47
56
|
if (iGroupIndex === 0) {
|
|
48
57
|
return iGroupIndex;
|
|
49
58
|
}
|
|
59
|
+
return fnFirstGroupWithoutTitle(oModifier, aStopToken, aContent)
|
|
60
|
+
.then(function(bFirstGroupWithoutName){
|
|
61
|
+
if (bFirstGroupWithoutName) {
|
|
62
|
+
iCurrentGroupIndex++;
|
|
63
|
+
}
|
|
50
64
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
oResult = aContent[i];
|
|
61
|
-
return aContent.indexOf(oResult);
|
|
65
|
+
for (var i = 0; i < aContent.length; i++) {
|
|
66
|
+
var sType = oModifier.getControlType(aContent[i]);
|
|
67
|
+
if (aStopToken.indexOf(sType) > -1) {
|
|
68
|
+
iCurrentGroupIndex++;
|
|
69
|
+
if (iCurrentGroupIndex === iGroupIndex) {
|
|
70
|
+
oResult = aContent[i];
|
|
71
|
+
return aContent.indexOf(oResult);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
62
74
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return aContent.length;
|
|
75
|
+
return aContent.length;
|
|
76
|
+
});
|
|
66
77
|
};
|
|
67
78
|
|
|
68
79
|
/**
|
|
@@ -74,14 +85,14 @@ sap.ui.define([
|
|
|
74
85
|
* @param {object} mPropertyBag.modifier Modifier for the controls
|
|
75
86
|
* @param {object} mPropertyBag.appComponent Component in which the change should be applied
|
|
76
87
|
* @param {object} mPropertyBag.view Application view
|
|
77
|
-
* @return {
|
|
88
|
+
* @return {Promise} Promise resolving when change is applied successfully
|
|
78
89
|
* @public
|
|
79
90
|
*/
|
|
80
91
|
AddSimpleFormGroup.applyChange = function (oChangeWrapper, oForm, mPropertyBag) {
|
|
81
92
|
var oModifier = mPropertyBag.modifier;
|
|
82
93
|
var oView = mPropertyBag.view;
|
|
83
|
-
var oAppComponent = mPropertyBag.appComponent
|
|
84
|
-
|
|
94
|
+
var oAppComponent = mPropertyBag.appComponent;
|
|
95
|
+
var iInsertIndex;
|
|
85
96
|
|
|
86
97
|
var oChange = oChangeWrapper.getDefinition();
|
|
87
98
|
if (oChange.texts && oChange.texts.groupLabel && oChange.texts.groupLabel.value &&
|
|
@@ -100,37 +111,39 @@ sap.ui.define([
|
|
|
100
111
|
}
|
|
101
112
|
oChangeWrapper.setRevertData({groupId: sGroupId});
|
|
102
113
|
var sLabelText = oChange.texts.groupLabel.value;
|
|
103
|
-
|
|
104
|
-
var aContent = oModifier.getAggregation(oForm, AddSimpleFormGroup.CONTENT_AGGREGATION);
|
|
105
|
-
|
|
106
|
-
var iInsertIndex;
|
|
107
114
|
var iRelativeIndex;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
115
|
+
return Promise.resolve()
|
|
116
|
+
.then(function(){
|
|
117
|
+
return oModifier.getAggregation(oForm, AddSimpleFormGroup.CONTENT_AGGREGATION);
|
|
118
|
+
})
|
|
119
|
+
.then(function(aContent){
|
|
120
|
+
if (typeof oChange.content.group.index === "number") {
|
|
121
|
+
// The old code support
|
|
122
|
+
return oChange.content.group.index;
|
|
123
|
+
} else {
|
|
124
|
+
iRelativeIndex = oChange.content.group.relativeIndex;
|
|
125
|
+
return fnMapGroupIndexToContentAggregationIndex(oModifier,
|
|
126
|
+
["sap.ui.core.Title", "sap.m.Title", "sap.m.Toolbar", "sap.m.OverflowToolbar"],
|
|
127
|
+
aContent, iRelativeIndex);
|
|
128
|
+
}
|
|
129
|
+
})
|
|
130
|
+
.then(function(iReturnedInsertIndex) {
|
|
131
|
+
iInsertIndex = iReturnedInsertIndex;
|
|
132
|
+
// Check if the change is applicable
|
|
133
|
+
if (oModifier.bySelector(sGroupId, oAppComponent)) {
|
|
134
|
+
return Base.markAsNotApplicable("Control to be created already exists:" + sGroupId);
|
|
135
|
+
}
|
|
136
|
+
return oModifier.createControl("sap.ui.core.Title", oAppComponent, oView, sGroupId);
|
|
137
|
+
})
|
|
138
|
+
.then(function(oTitle) {
|
|
139
|
+
oModifier.setProperty(oTitle, "text", sLabelText);
|
|
140
|
+
return oModifier.insertAggregation(oForm, "content", oTitle, iInsertIndex, oView);
|
|
141
|
+
});
|
|
127
142
|
|
|
128
143
|
} else {
|
|
129
144
|
Log.error("Change does not contain sufficient information to be applied: [" + oChange.layer + "]" + oChange.namespace + "/" + oChange.fileName + "." + oChange.fileType);
|
|
130
145
|
//however subsequent changes should be applied
|
|
131
146
|
}
|
|
132
|
-
|
|
133
|
-
return true;
|
|
134
147
|
};
|
|
135
148
|
|
|
136
149
|
/**
|
|
@@ -198,7 +211,7 @@ sap.ui.define([
|
|
|
198
211
|
* @param {object} mPropertyBag.modifier Modifier for the controls
|
|
199
212
|
* @param {object} mPropertyBag.appComponent Component in which the change should be applied
|
|
200
213
|
* @param {object} mPropertyBag.view Application view
|
|
201
|
-
* @return {
|
|
214
|
+
* @return {Promise} Promise resolving when change is successfully reverted
|
|
202
215
|
* @public
|
|
203
216
|
*/
|
|
204
217
|
AddSimpleFormGroup.revertChange = function (oChangeWrapper, oForm, mPropertyBag) {
|
|
@@ -209,11 +222,14 @@ sap.ui.define([
|
|
|
209
222
|
|
|
210
223
|
var oGroupSelector = oModifier.getSelector(sGroupId, oAppComponent);
|
|
211
224
|
var oGroup = oModifier.bySelector(oGroupSelector, oAppComponent, oView);
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
225
|
+
return Promise.resolve()
|
|
226
|
+
.then(function() {
|
|
227
|
+
return oModifier.removeAggregation(oForm, AddSimpleFormGroup.CONTENT_AGGREGATION, oGroup);
|
|
228
|
+
})
|
|
229
|
+
.then(function() {
|
|
230
|
+
oModifier.destroy(oGroup);
|
|
231
|
+
oChangeWrapper.resetRevertData();
|
|
232
|
+
});
|
|
217
233
|
};
|
|
218
234
|
|
|
219
235
|
AddSimpleFormGroup.getChangeVisualizationInfo = function(oChange, oAppComponent) {
|
|
@@ -4,14 +4,20 @@
|
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
sap.ui.define([
|
|
7
|
+
sap.ui.define([
|
|
8
|
+
"sap/ui/core/util/reflection/JsControlTreeModifier",
|
|
9
|
+
"sap/base/Log"
|
|
10
|
+
], function(
|
|
11
|
+
JsControlTreeModifier,
|
|
12
|
+
Log
|
|
13
|
+
) {
|
|
8
14
|
"use strict";
|
|
9
15
|
|
|
10
16
|
/**
|
|
11
17
|
* Change handler for hiding of a control.
|
|
12
18
|
* @alias sap.ui.fl.changeHandler.HideControl
|
|
13
19
|
* @author SAP SE
|
|
14
|
-
* @version 1.
|
|
20
|
+
* @version 1.93.3
|
|
15
21
|
* @experimental Since 1.27.0
|
|
16
22
|
*/
|
|
17
23
|
var HideForm = { };
|
|
@@ -31,97 +37,134 @@ sap.ui.define(['sap/ui/fl/changeHandler/JsControlTreeModifier', "sap/base/Log"],
|
|
|
31
37
|
return aContent[iIndex];
|
|
32
38
|
}
|
|
33
39
|
}
|
|
40
|
+
return undefined;
|
|
34
41
|
};
|
|
35
42
|
|
|
43
|
+
function _isXmlModifier(mPropertyBag) {
|
|
44
|
+
return mPropertyBag.modifier.targets === "xmlTree";
|
|
45
|
+
}
|
|
46
|
+
|
|
36
47
|
/**
|
|
37
48
|
* Hides a control.
|
|
38
49
|
*
|
|
39
50
|
* @param {sap.ui.fl.Change} oChange change object with instructions to be applied on the control map
|
|
40
51
|
* @param {sap.ui.core.Control} oControl control that matches the change selector for applying the change
|
|
41
52
|
* @param {object} mPropertyBag - map of properties
|
|
42
|
-
* @returns {
|
|
53
|
+
* @returns {Promise} Promise resolving when change is successfully applied
|
|
43
54
|
* @public
|
|
44
55
|
*/
|
|
45
56
|
HideForm.applyChange = function(oChange, oControl, mPropertyBag) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var oAppComponent = mPropertyBag.appComponent;
|
|
50
|
-
|
|
51
|
-
var oChangeDefinition = oChange.getDefinition();
|
|
52
|
-
|
|
53
|
-
// !important : sHideId was used in 1.40, do not remove for compatibility!
|
|
54
|
-
var oRemovedElement = oModifier.bySelector(oChangeDefinition.content.elementSelector || oChangeDefinition.content.sHideId, oAppComponent, oView);
|
|
55
|
-
var aContent = oModifier.getAggregation(oControl, "content");
|
|
56
|
-
var iStart = -1;
|
|
57
|
-
var mState = this._getState(oControl, oModifier, oAppComponent);
|
|
58
|
-
oChange.setRevertData(mState);
|
|
59
|
-
|
|
60
|
-
// this is needed to trigger a refresh of a simpleform! Otherwise simpleForm content and visualization are not in sync
|
|
61
|
-
oModifier.removeAllAggregation(oControl, "content");
|
|
62
|
-
for (var i = 0; i < aContent.length; ++i) {
|
|
63
|
-
oModifier.insertAggregation(oControl, "content", aContent[i], i, oView);
|
|
64
|
-
}
|
|
57
|
+
var oModifier = mPropertyBag.modifier;
|
|
58
|
+
var oView = mPropertyBag.view;
|
|
59
|
+
var oAppComponent = mPropertyBag.appComponent;
|
|
65
60
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
61
|
+
var oChangeDefinition = oChange.getDefinition();
|
|
62
|
+
|
|
63
|
+
// in case of custom fields the application needs to be on JS.
|
|
64
|
+
// In the other case the visuality of the hidden control will be overriden by the custom field binding afterwards
|
|
65
|
+
if (_isXmlModifier(mPropertyBag)) {
|
|
66
|
+
return Promise.reject(Error("Change cannot be applied in XML. Retrying in JS."));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// !important : sHideId was used in 1.40, do not remove for compatibility!
|
|
70
|
+
var oRemovedElement = oModifier.bySelector(oChangeDefinition.content.elementSelector || oChangeDefinition.content.sHideId, oAppComponent, oView);
|
|
71
|
+
var aContent;
|
|
72
|
+
|
|
73
|
+
return this._getState(oControl, oModifier, oAppComponent)
|
|
74
|
+
.then(function(mState) {
|
|
75
|
+
oChange.setRevertData(mState);
|
|
76
|
+
return oModifier.getAggregation(oControl, "content");
|
|
77
|
+
})
|
|
78
|
+
.then(function(aAggregationContent) {
|
|
79
|
+
aContent = aAggregationContent;
|
|
80
|
+
// this is needed to trigger a refresh of a simpleform! Otherwise simpleForm content and visualization are not in sync
|
|
81
|
+
return oModifier.removeAllAggregation(oControl, "content");
|
|
82
|
+
})
|
|
83
|
+
.then(function() {
|
|
84
|
+
return aContent.reduce(function(oPreviousPromise, oContent, i) {
|
|
85
|
+
return oPreviousPromise
|
|
86
|
+
.then(oModifier.insertAggregation.bind(oModifier, oControl, "content", oContent, i, oView));
|
|
87
|
+
}, Promise.resolve());
|
|
88
|
+
})
|
|
89
|
+
.then(function() {
|
|
90
|
+
var iStart = -1;
|
|
91
|
+
if (oChangeDefinition.changeType === "hideSimpleFormField") {
|
|
92
|
+
aContent.some(function (oField, index) {
|
|
98
93
|
if (oField === oRemovedElement) {
|
|
99
94
|
iStart = index;
|
|
95
|
+
oModifier.setVisible(oField, false);
|
|
100
96
|
}
|
|
101
97
|
if (iStart >= 0 && index > iStart) {
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
oModifier.insertAggregation(oControl, "content", oField, 0, oView);
|
|
106
|
-
}
|
|
98
|
+
if ((oModifier.getControlType(oField) === "sap.m.Label") ||
|
|
99
|
+
(oModifier.getControlType(oField) === "sap.ui.comp.smartfield.SmartLabel") ||
|
|
100
|
+
fnIsTitleOrToolbar(oField, oModifier)) {
|
|
107
101
|
return true;
|
|
108
102
|
} else {
|
|
109
103
|
oModifier.setVisible(oField, false);
|
|
110
104
|
}
|
|
111
105
|
}
|
|
106
|
+
});
|
|
107
|
+
} else if (oChangeDefinition.changeType === "removeSimpleFormGroup") {
|
|
108
|
+
var aPromises = [];
|
|
109
|
+
var oTitleOrToolbar = fnGetFirstToolbarOrTitle(aContent, oModifier);
|
|
110
|
+
var bFirstContainerWithoutTitle = oTitleOrToolbar && !oRemovedElement;
|
|
111
|
+
aContent.some(function (oField, index) {
|
|
112
|
+
// if there is no Title/Toolbar, there is only the one FormContainer without Title/Toolbar.
|
|
113
|
+
// Therefor all Fields will be hidden.
|
|
114
|
+
if (!oTitleOrToolbar) {
|
|
115
|
+
oModifier.setVisible(oField, false);
|
|
116
|
+
} else if (bFirstContainerWithoutTitle) {
|
|
117
|
+
// if there is oTitleOrToolbar but no oRemovedElement the first FormContainer needs to be hidden.
|
|
118
|
+
// This FormContainer has no Title/Toolbar, but there are FormContainers with Title/Toolbar
|
|
119
|
+
// Therefor we have to set iStart to 0 and hide the first Field once
|
|
120
|
+
iStart = 0;
|
|
121
|
+
oModifier.setVisible(oField, false);
|
|
122
|
+
bFirstContainerWithoutTitle = false;
|
|
123
|
+
} else {
|
|
124
|
+
if (oField === oRemovedElement) {
|
|
125
|
+
iStart = index;
|
|
126
|
+
}
|
|
127
|
+
if (iStart >= 0 && index > iStart) {
|
|
128
|
+
if (fnIsTitleOrToolbar(oField, oModifier)) {
|
|
129
|
+
if (iStart === 0) {
|
|
130
|
+
aPromises.push(function() {
|
|
131
|
+
return Promise.resolve()
|
|
132
|
+
.then(oModifier.removeAggregation.bind(oModifier, oControl, "content", oField, oView));
|
|
133
|
+
});
|
|
134
|
+
aPromises.push(function() {
|
|
135
|
+
return Promise.resolve()
|
|
136
|
+
.then(oModifier.insertAggregation.bind(oModifier, oControl, "content", oField, 0, oView));
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return true;
|
|
140
|
+
} else {
|
|
141
|
+
oModifier.setVisible(oField, false);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
if (oRemovedElement) {
|
|
147
|
+
aPromises.push(function() {
|
|
148
|
+
return Promise.resolve()
|
|
149
|
+
.then(oModifier.removeAggregation.bind(oModifier, oControl, "content", oRemovedElement, oView));
|
|
150
|
+
});
|
|
151
|
+
aPromises.push(function() {
|
|
152
|
+
return Promise.resolve()
|
|
153
|
+
.then(oModifier.insertAggregation.bind(oModifier, oControl, "dependents", oRemovedElement, 0, oView));
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
if (aPromises.length > 0) {
|
|
157
|
+
return aPromises.reduce(function(oPreviousPromise, oCurrentPromise) {
|
|
158
|
+
return oPreviousPromise.then(oCurrentPromise);
|
|
159
|
+
}, Promise.resolve());
|
|
112
160
|
}
|
|
113
|
-
});
|
|
114
|
-
if (oRemovedElement) {
|
|
115
|
-
oModifier.removeAggregation(oControl, "content", oRemovedElement, oView);
|
|
116
|
-
oModifier.insertAggregation(oControl, "dependents", oRemovedElement, 0, oView);
|
|
117
161
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
162
|
+
return Promise.resolve();
|
|
163
|
+
})
|
|
164
|
+
. catch(function(oError) {
|
|
165
|
+
oChange.resetRevertData();
|
|
166
|
+
Log.error(oError.message || oError.name);
|
|
167
|
+
});
|
|
125
168
|
};
|
|
126
169
|
|
|
127
170
|
/**
|
|
@@ -160,37 +203,68 @@ sap.ui.define(['sap/ui/fl/changeHandler/JsControlTreeModifier', "sap/base/Log"],
|
|
|
160
203
|
};
|
|
161
204
|
|
|
162
205
|
HideForm._getState = function (oControl, oModifier, oAppComponent) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
206
|
+
return Promise.resolve()
|
|
207
|
+
.then(function(){
|
|
208
|
+
return oModifier.getAggregation(oControl, "content");
|
|
209
|
+
})
|
|
210
|
+
.then(function(aContent){
|
|
211
|
+
if (!aContent){
|
|
212
|
+
return Promise.reject(new Error("Cannot get control state: 'content' aggregation doesn't exist"));
|
|
213
|
+
}
|
|
166
214
|
return {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
215
|
+
content : aContent.map(function(oElement) {
|
|
216
|
+
return {
|
|
217
|
+
elementSelector : oModifier.getSelector(oModifier.getId(oElement), oAppComponent),
|
|
218
|
+
visible : oElement.getVisible ? oElement.getVisible() : undefined,
|
|
219
|
+
index : aContent.indexOf(oElement)
|
|
220
|
+
};
|
|
221
|
+
})
|
|
170
222
|
};
|
|
171
|
-
})
|
|
172
|
-
};
|
|
223
|
+
});
|
|
173
224
|
};
|
|
174
225
|
|
|
226
|
+
/**
|
|
227
|
+
* Reverts the hide simple form change.
|
|
228
|
+
*
|
|
229
|
+
* @param {sap.ui.fl.Change} oChange change object with instructions to be applied on the control map
|
|
230
|
+
* @param {sap.ui.core.Control} oControl control that matches the change selector for applying the change
|
|
231
|
+
* @param {object} mPropertyBag - map of properties
|
|
232
|
+
* @returns {Promise} Promise resolving when change is successfully reverted
|
|
233
|
+
* @public
|
|
234
|
+
*/
|
|
175
235
|
HideForm.revertChange = function (oChange, oControl, mPropertyBag) {
|
|
176
236
|
var mState = oChange.getRevertData();
|
|
177
237
|
var oAppComponent = mPropertyBag.appComponent;
|
|
178
238
|
var oModifier = mPropertyBag.modifier;
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
return
|
|
187
|
-
|
|
239
|
+
|
|
240
|
+
return Promise.resolve()
|
|
241
|
+
.then(oModifier.removeAllAggregation.bind(oModifier, oControl, "content"))
|
|
242
|
+
.then(function() {
|
|
243
|
+
return mState.content.reduce(function(oPreviousPromise, oElementState) {
|
|
244
|
+
var oElement = oModifier.bySelector(oElementState.elementSelector, oAppComponent, mPropertyBag.view);
|
|
245
|
+
var sElementId = oModifier.getId(oElement);
|
|
246
|
+
return oPreviousPromise
|
|
247
|
+
.then(oModifier.getAggregation.bind(oModifier, oControl, "dependents"))
|
|
248
|
+
.then(function(aDependents) {
|
|
249
|
+
var oPromise = Promise.resolve();
|
|
250
|
+
aDependents.some(function(oDependent) {
|
|
251
|
+
var sDependentId = oModifier.getId(oDependent);
|
|
252
|
+
if (sDependentId === sElementId) {
|
|
253
|
+
oPromise = oPromise.then(oModifier.removeAggregation.bind(oModifier, oControl, "dependents", oDependent, mPropertyBag.view));
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
return oPromise;
|
|
258
|
+
})
|
|
259
|
+
.then(oModifier.insertAggregation.bind(oModifier, oControl, "content", oElement, oElementState.index, mPropertyBag.view))
|
|
260
|
+
.then(function() {
|
|
261
|
+
oModifier.setProperty(oElement, "visible", oElementState.visible);
|
|
262
|
+
});
|
|
263
|
+
}, Promise.resolve())
|
|
264
|
+
.then(function() {
|
|
265
|
+
oChange.resetRevertData();
|
|
266
|
+
});
|
|
188
267
|
});
|
|
189
|
-
oModifier.insertAggregation(oControl, "content", oElement, oElementState.index, mPropertyBag.view);
|
|
190
|
-
oModifier.setProperty(oElement, "visible", oElementState.visible);
|
|
191
|
-
});
|
|
192
|
-
oChange.resetRevertData();
|
|
193
|
-
return true;
|
|
194
268
|
};
|
|
195
269
|
|
|
196
270
|
HideForm.getChangeVisualizationInfo = function(oChange, oAppComponent) {
|