@openui5/sap.ui.layout 1.91.0 → 1.93.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.
- package/.reuse/dep5 +46 -0
- package/THIRDPARTY.txt +59 -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 +2 -2
- package/src/sap/ui/layout/DynamicSideContent.js +4 -4
- 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 +40 -2
- 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 +13 -4
- package/src/sap/ui/layout/Splitter.js +2 -2
- package/src/sap/ui/layout/SplitterLayoutData.js +6 -2
- 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 +8 -5
- package/src/sap/ui/layout/form/ColumnLayoutRenderer.js +4 -5
- package/src/sap/ui/layout/form/Form.js +3 -3
- package/src/sap/ui/layout/form/FormContainer.js +3 -3
- package/src/sap/ui/layout/form/FormElement.js +2 -4
- package/src/sap/ui/layout/form/FormLayout.js +61 -5
- package/src/sap/ui/layout/form/FormLayoutRenderer.js +30 -19
- 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/GridLayoutRenderer.js +5 -9
- package/src/sap/ui/layout/form/ResponsiveGridLayout.js +8 -10
- package/src/sap/ui/layout/form/ResponsiveLayout.js +9 -4
- package/src/sap/ui/layout/form/SemanticFormElement.js +53 -36
- package/src/sap/ui/layout/form/SimpleForm.js +12 -10
- package/src/sap/ui/layout/library.js +4 -2
- package/src/sap/ui/layout/themes/base/GridLayout.less +0 -17
- package/src/sap/ui/layout/themes/base/ResponsiveLayout.less +0 -10
- package/src/sap/ui/layout/themes/base/ResponsiveSplitter.less +4 -2
- package/src/sap/ui/layout/themes/base/Splitter.less +1 -9
|
@@ -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.2
|
|
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) {
|