@openui5/sap.ui.layout 1.92.0 → 1.95.0

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 (64) hide show
  1. package/.reuse/dep5 +1 -6
  2. package/THIRDPARTY.txt +4 -10
  3. package/package.json +2 -2
  4. package/src/sap/ui/layout/.library +1 -1
  5. package/src/sap/ui/layout/AlignedFlowLayout.js +7 -3
  6. package/src/sap/ui/layout/AssociativeSplitter.js +1 -1
  7. package/src/sap/ui/layout/BlockLayout.js +1 -1
  8. package/src/sap/ui/layout/BlockLayoutCell.js +1 -1
  9. package/src/sap/ui/layout/BlockLayoutCellData.js +1 -1
  10. package/src/sap/ui/layout/BlockLayoutRow.js +1 -1
  11. package/src/sap/ui/layout/DynamicSideContent.js +1 -1
  12. package/src/sap/ui/layout/FixFlex.js +1 -1
  13. package/src/sap/ui/layout/Grid.js +1 -1
  14. package/src/sap/ui/layout/GridData.js +1 -1
  15. package/src/sap/ui/layout/GridRenderer.js +1 -1
  16. package/src/sap/ui/layout/HorizontalLayout.js +1 -1
  17. package/src/sap/ui/layout/PaneContainer.js +1 -1
  18. package/src/sap/ui/layout/ResponsiveFlowLayout.js +1 -1
  19. package/src/sap/ui/layout/ResponsiveFlowLayoutData.js +1 -1
  20. package/src/sap/ui/layout/ResponsiveSplitter.js +1 -1
  21. package/src/sap/ui/layout/ResponsiveSplitterPage.js +1 -1
  22. package/src/sap/ui/layout/SplitPane.js +1 -1
  23. package/src/sap/ui/layout/Splitter.js +2 -2
  24. package/src/sap/ui/layout/SplitterLayoutData.js +1 -1
  25. package/src/sap/ui/layout/VerticalLayout.js +1 -1
  26. package/src/sap/ui/layout/changeHandler/AddFormContainer.js +49 -22
  27. package/src/sap/ui/layout/changeHandler/AddFormField.js +40 -30
  28. package/src/sap/ui/layout/changeHandler/AddSimpleFormField.js +66 -37
  29. package/src/sap/ui/layout/changeHandler/AddSimpleFormGroup.js +76 -60
  30. package/src/sap/ui/layout/changeHandler/HideSimpleForm.js +166 -92
  31. package/src/sap/ui/layout/changeHandler/MoveSimpleForm.js +187 -145
  32. package/src/sap/ui/layout/changeHandler/RenameFormContainer.js +45 -35
  33. package/src/sap/ui/layout/changeHandler/RenameSimpleForm.js +14 -12
  34. package/src/sap/ui/layout/changeHandler/UnhideSimpleForm.js +66 -51
  35. package/src/sap/ui/layout/cssgrid/CSSGrid.js +72 -69
  36. package/src/sap/ui/layout/cssgrid/GridBasicLayout.js +1 -1
  37. package/src/sap/ui/layout/cssgrid/GridBoxLayout.js +17 -8
  38. package/src/sap/ui/layout/cssgrid/GridItemLayoutData.js +1 -1
  39. package/src/sap/ui/layout/cssgrid/GridLayoutBase.js +1 -1
  40. package/src/sap/ui/layout/cssgrid/GridLayoutDelegate.js +1 -1
  41. package/src/sap/ui/layout/cssgrid/GridResponsiveLayout.js +1 -1
  42. package/src/sap/ui/layout/cssgrid/GridSettings.js +1 -1
  43. package/src/sap/ui/layout/cssgrid/ResponsiveColumnItemLayoutData.js +1 -1
  44. package/src/sap/ui/layout/cssgrid/ResponsiveColumnLayout.js +1 -1
  45. package/src/sap/ui/layout/designtime/form/Form.designtime.js +1 -1
  46. package/src/sap/ui/layout/designtime/form/SimpleForm.designtime.js +17 -6
  47. package/src/sap/ui/layout/form/ColumnContainerData.js +1 -1
  48. package/src/sap/ui/layout/form/ColumnElementData.js +1 -1
  49. package/src/sap/ui/layout/form/ColumnLayout.js +1 -1
  50. package/src/sap/ui/layout/form/Form.js +1 -1
  51. package/src/sap/ui/layout/form/FormContainer.js +1 -1
  52. package/src/sap/ui/layout/form/FormElement.js +1 -1
  53. package/src/sap/ui/layout/form/FormLayout.js +3 -3
  54. package/src/sap/ui/layout/form/FormLayoutRenderer.js +3 -2
  55. package/src/sap/ui/layout/form/GridContainerData.js +1 -1
  56. package/src/sap/ui/layout/form/GridElementData.js +1 -1
  57. package/src/sap/ui/layout/form/GridLayout.js +2 -2
  58. package/src/sap/ui/layout/form/ResponsiveGridLayout.js +2 -7
  59. package/src/sap/ui/layout/form/ResponsiveLayout.js +2 -1
  60. package/src/sap/ui/layout/form/SemanticFormElement.js +49 -32
  61. package/src/sap/ui/layout/form/SimpleForm.js +11 -9
  62. package/src/sap/ui/layout/library.js +3 -2
  63. package/src/sap/ui/layout/messagebundle_el.properties +1 -1
  64. package/src/sap/ui/layout/cssgrid/GridBoxLayoutStyleHelper.js +0 -62
@@ -5,9 +5,11 @@
5
5
  */
6
6
 
7
7
  sap.ui.define([
8
- "sap/ui/fl/changeHandler/BaseAddViaDelegate"
8
+ "sap/ui/fl/changeHandler/BaseAddViaDelegate",
9
+ "sap/ui/core/util/reflection/JsControlTreeModifier"
9
10
  ], function(
10
- BaseAddViaDelegate
11
+ BaseAddViaDelegate,
12
+ JsControlTreeModifier
11
13
  ) {
12
14
  "use strict";
13
15
 
@@ -30,29 +32,29 @@ sap.ui.define([
30
32
  // This logic is for insertIndex being a desired index of a form element inside a container
31
33
  // However we cannot allow that new fields are added inside other FormElements, therefore
32
34
  // we must find the end of the FormElement to add the new FormElement there
33
- if (aContent.length === 1 || aContent.length === iIndexOfHeader + 1){
35
+ if (aContent.length === 1 || aContent.length === iIndexOfHeader + 1) {
34
36
  // Empty container (only header or toolbar)
35
37
  iNewIndex = aContent.length;
36
38
  } else {
37
39
  var j = 0;
38
- for (j = iIndexOfHeader + 1; j < aContent.length; j++){
40
+ for (j = iIndexOfHeader + 1; j < aContent.length; j++) {
39
41
  var sControlType = oModifier.getControlType(aContent[j]);
40
42
  // When the next control is a label (= end of FormElement)
41
- if (sControlType === sTypeLabel || sControlType === sTypeSmartLabel ){
42
- if (iFormElementIndex == insertIndex){
43
+ if (sControlType === sTypeLabel || sControlType === sTypeSmartLabel) {
44
+ if (iFormElementIndex === insertIndex) {
43
45
  iNewIndex = j;
44
46
  break;
45
47
  }
46
48
  iFormElementIndex++;
47
49
  }
48
50
  // Next control is a title or toolbar (= end of container)
49
- if (sControlType === sTypeTitle || sControlType === sTypeToolBar){
51
+ if (sControlType === sTypeTitle || sControlType === sTypeToolBar) {
50
52
  iNewIndex = j;
51
53
  break;
52
54
  }
53
55
 
54
56
  // If there are no more titles, toolbars or labels (= this is the last FormElement) -> insert at end
55
- if (j === (aContent.length - 1)){
57
+ if (j === (aContent.length - 1)) {
56
58
  iNewIndex = aContent.length;
57
59
  }
58
60
  }
@@ -67,15 +69,17 @@ sap.ui.define([
67
69
  }
68
70
 
69
71
  function recreateContentAggregation(oSimpleForm, aContentClone, oModifier, mPropertyBag) {
70
- oModifier.removeAllAggregation(oSimpleForm, "content");
71
- for (var i = 0; i < aContentClone.length; ++i) {
72
- oModifier.insertAggregation(oSimpleForm,
73
- "content",
74
- aContentClone[i],
75
- i,
76
- mPropertyBag.view
77
- );
78
- }
72
+ return aContentClone.reduce(function(oPreviousPromise, oContentClone, iIndex) {
73
+ return oPreviousPromise
74
+ .then(function() {
75
+ return oModifier.insertAggregation(oSimpleForm,
76
+ "content",
77
+ oContentClone,
78
+ iIndex,
79
+ mPropertyBag.view
80
+ );
81
+ });
82
+ }, Promise.resolve());
79
83
  }
80
84
 
81
85
  /**
@@ -87,41 +91,52 @@ sap.ui.define([
87
91
  *
88
92
  * @author SAP SE
89
93
  *
90
- * @version 1.92.0
94
+ * @version 1.95.0
91
95
  *
92
96
  * @experimental Since 1.49.0 This class is experimental and provides only limited functionality. Also the API might be
93
97
  * changed in future.
94
98
  */
95
99
  var AddSimpleFormField = BaseAddViaDelegate.createAddViaDelegateChangeHandler({
96
- addProperty : function(mPropertyBag) {
100
+ addProperty: function(mPropertyBag) {
97
101
  var oSimpleForm = mPropertyBag.control;
98
102
 
99
103
  var mInnerControls = mPropertyBag.innerControls;
100
104
  var oModifier = mPropertyBag.modifier;
101
105
  var oAppComponent = mPropertyBag.appComponent;
106
+ var aContent;
107
+ var iNewIndex;
108
+ var aContentClone;
102
109
 
103
110
  var oChange = mPropertyBag.change;
104
111
  // as the label is stored independent of the field and will not be destroyed by destroying the field, is needs to be remembered
105
112
  var oRevertData = oChange.getRevertData();
106
113
  oRevertData.labelSelector = oModifier.getSelector(mInnerControls.label, oAppComponent);
107
114
 
108
- var aContent = oModifier.getAggregation(oSimpleForm, "content");
109
- var iNewIndex = getIndex(aContent, mPropertyBag);
110
- var aContentClone = insertLabelAndField(aContent, iNewIndex, mInnerControls);
111
-
112
- recreateContentAggregation(oSimpleForm, aContentClone, oModifier, mPropertyBag);
113
-
114
- if (mInnerControls.valueHelp) {
115
- oModifier.insertAggregation(
116
- oSimpleForm,
117
- "dependents",
118
- mInnerControls.valueHelp,
119
- 0,
120
- mPropertyBag.view
121
- );
122
- }
115
+ return Promise.resolve()
116
+ .then(oModifier.getAggregation.bind(oModifier, oSimpleForm, "content"))
117
+ .then(function(aAggregationContent) {
118
+ aContent = aAggregationContent;
119
+ iNewIndex = getIndex(aContent, mPropertyBag);
120
+ aContentClone = insertLabelAndField(aContent, iNewIndex, mInnerControls);
121
+ return oModifier.removeAllAggregation(oSimpleForm, "content");
122
+ })
123
+ .then(function() {
124
+ return recreateContentAggregation(oSimpleForm, aContentClone, oModifier, mPropertyBag);
125
+ })
126
+ .then(function() {
127
+ if (mInnerControls.valueHelp) {
128
+ return oModifier.insertAggregation(
129
+ oSimpleForm,
130
+ "dependents",
131
+ mInnerControls.valueHelp,
132
+ 0,
133
+ mPropertyBag.view
134
+ );
135
+ }
136
+ return undefined;
137
+ });
123
138
  },
124
- revertAdditionalControls : function(mPropertyBag) {
139
+ revertAdditionalControls: function(mPropertyBag) {
125
140
  var oSimpleForm = mPropertyBag.control;
126
141
  var oChange = mPropertyBag.change;
127
142
  var oModifier = mPropertyBag.modifier;
@@ -130,9 +145,11 @@ sap.ui.define([
130
145
  var mLabelSelector = oChange.getRevertData().labelSelector;
131
146
  if (mLabelSelector) {
132
147
  var oLabel = oModifier.bySelector(mLabelSelector, oAppComponent);
133
- oModifier.removeAggregation(oSimpleForm, "content", oLabel);
134
- oModifier.destroy(oLabel);
148
+ return Promise.resolve()
149
+ .then(oModifier.removeAggregation.bind(oModifier, oSimpleForm, "content", oLabel))
150
+ .then(oModifier.destroy.bind(oModifier, oLabel));
135
151
  }
152
+ return Promise.resolve();
136
153
  },
137
154
  aggregationName: "content",
138
155
  mapParentIdIntoChange: function (oChange, mSpecificChangeInfo, mPropertyBag) {
@@ -154,6 +171,18 @@ sap.ui.define([
154
171
  supportsDefault: true
155
172
  });
156
173
 
174
+ AddSimpleFormField.getChangeVisualizationInfo = function(oChange, oAppComponent) {
175
+ var oRevertData = oChange.getRevertData();
176
+ if (oRevertData && oRevertData.labelSelector) {
177
+ return {
178
+ affectedControls: [JsControlTreeModifier.bySelector(oRevertData.labelSelector, oAppComponent).getParent().getId()]
179
+ };
180
+ }
181
+ return {
182
+ affectedControls: [oChange.getContent().newFieldSelector]
183
+ };
184
+ };
185
+
157
186
  return AddSimpleFormField;
158
187
  },
159
188
  /* bExport= */true);
@@ -6,7 +6,7 @@
6
6
 
7
7
  sap.ui.define([
8
8
  "sap/ui/fl/changeHandler/Base",
9
- "sap/ui/fl/changeHandler/JsControlTreeModifier",
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.92.0
22
+ * @version 1.95.0
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
- for (var i = 0; i < aContent.length; i++) {
31
- var sType = oModifier.getControlType(aContent[i]);
32
- if (aStopToken.indexOf(sType) === -1) {
33
- if (oModifier.getVisible(aContent[i])) {
34
- return true;
35
- }
36
- } else {
37
- return false;
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
- if (fnFirstGroupWithoutTitle(oModifier, aStopToken, aContent)) {
52
- iCurrentGroupIndex++;
53
- }
54
-
55
- for (var i = 0; i < aContent.length; i++) {
56
- var sType = oModifier.getControlType(aContent[i]);
57
- if (aStopToken.indexOf(sType) > -1) {
58
- iCurrentGroupIndex++;
59
- if (iCurrentGroupIndex === iGroupIndex) {
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 {boolean} True if successful
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
- oTitle;
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
- if (typeof oChange.content.group.index === "number") {
110
- // The old code support
111
- iInsertIndex = oChange.content.group.index;
112
- } else {
113
- iRelativeIndex = oChange.content.group.relativeIndex;
114
- iInsertIndex = fnMapGroupIndexToContentAggregationIndex(oModifier,
115
- ["sap.ui.core.Title", "sap.m.Title", "sap.m.Toolbar", "sap.m.OverflowToolbar"],
116
- aContent, iRelativeIndex);
117
- }
118
-
119
- // Check if the change is applicable
120
- if (oModifier.bySelector(sGroupId, oAppComponent)) {
121
- return Base.markAsNotApplicable("Control to be created already exists:" + sGroupId);
122
- }
123
- oTitle = oModifier.createControl("sap.ui.core.Title", oAppComponent, oView, sGroupId);
124
-
125
- oModifier.setProperty(oTitle, "text", sLabelText);
126
- oModifier.insertAggregation(oForm, "content", oTitle, iInsertIndex, oView);
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 {boolean} True if successful
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
- oModifier.removeAggregation(oForm, AddSimpleFormGroup.CONTENT_AGGREGATION, oGroup);
213
- oModifier.destroy(oGroup);
214
- oChangeWrapper.resetRevertData();
215
-
216
- return true;
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) {