@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
|
@@ -20,7 +20,7 @@ sap.ui.define([
|
|
|
20
20
|
*
|
|
21
21
|
* @alias sap.ui.layout.changeHandler.MoveSimpleForm
|
|
22
22
|
* @author SAP SE
|
|
23
|
-
* @version 1.
|
|
23
|
+
* @version 1.93.2
|
|
24
24
|
* @experimental Since 1.34.0
|
|
25
25
|
*/
|
|
26
26
|
var MoveSimpleForm = {};
|
|
@@ -36,54 +36,74 @@ sap.ui.define([
|
|
|
36
36
|
MoveSimpleForm.CONTENT_AGGREGATION = "content";
|
|
37
37
|
|
|
38
38
|
function firstGroupWithoutTitle(oModifier, aStopToken, aContent) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
return aContent.reduce(function(oPreviousPromise, oContent){
|
|
40
|
+
return oPreviousPromise
|
|
41
|
+
.then(function(bReturnValue){
|
|
42
|
+
if (bReturnValue !== undefined) {
|
|
43
|
+
return bReturnValue;
|
|
44
|
+
}
|
|
45
|
+
var sType = oModifier.getControlType(oContent);
|
|
46
|
+
if (aStopToken.indexOf(sType) === -1) {
|
|
47
|
+
return Promise.resolve()
|
|
48
|
+
.then(oModifier.getVisible.bind(oModifier, oContent))
|
|
49
|
+
.then(function(bVisible){
|
|
50
|
+
return bVisible || undefined;
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}, Promise.resolve());
|
|
49
57
|
}
|
|
50
58
|
|
|
51
59
|
function addTitleToFirstGroupIfNeeded(oChange, oModifier, aContent, oSimpleForm, mPropertyBag, aStopToken, oGroupSelector) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
return firstGroupWithoutTitle(oModifier, aStopToken, aContent)
|
|
61
|
+
.then(function(bFirstGroupWithoutName){
|
|
62
|
+
if (bFirstGroupWithoutName) {
|
|
63
|
+
var oView = mPropertyBag.view;
|
|
64
|
+
var oAppComponent = mPropertyBag.appComponent;
|
|
65
|
+
var oTitle;
|
|
66
|
+
return Promise.resolve()
|
|
67
|
+
.then(oModifier.createControl.bind(oModifier, "sap.ui.core.Title", oAppComponent, oView, oGroupSelector))
|
|
68
|
+
.then(function(oCreatedTitle){
|
|
69
|
+
oTitle = oCreatedTitle;
|
|
70
|
+
oModifier.setProperty(oTitle, "text", "");
|
|
71
|
+
return oModifier.insertAggregation(oSimpleForm, "content", oTitle, 0, oView);
|
|
72
|
+
})
|
|
73
|
+
.then(function() {
|
|
74
|
+
var oNewRevertData = oChange.getRevertData();
|
|
75
|
+
oNewRevertData.createdTitleSelector = mPropertyBag.modifier.getSelector(oTitle, mPropertyBag.appComponent);
|
|
76
|
+
oChange.setRevertData(oNewRevertData);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return Promise.resolve();
|
|
80
|
+
})
|
|
81
|
+
.then(function(){
|
|
82
|
+
return oModifier.getAggregation(oSimpleForm, "content");
|
|
83
|
+
});
|
|
66
84
|
}
|
|
67
85
|
|
|
68
86
|
function mapGroupIndexToContentAggregationIndex(oModifier, aStopToken, aContent, iGroupIndex) {
|
|
69
87
|
var oResult;
|
|
70
88
|
var iCurrentGroupIndex = -1;
|
|
71
89
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
for (var i = 0; i < aContent.length; i++) {
|
|
77
|
-
var sType = oModifier.getControlType(aContent[i]);
|
|
78
|
-
if (aStopToken.indexOf(sType) > -1) {
|
|
79
|
-
iCurrentGroupIndex++;
|
|
80
|
-
if (iCurrentGroupIndex === iGroupIndex) {
|
|
81
|
-
oResult = aContent[i];
|
|
82
|
-
break;
|
|
90
|
+
return firstGroupWithoutTitle(oModifier, aStopToken, aContent)
|
|
91
|
+
.then(function(bFirstGroupWithoutName){
|
|
92
|
+
if (bFirstGroupWithoutName) {
|
|
93
|
+
iCurrentGroupIndex++;
|
|
83
94
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
95
|
+
for (var i = 0; i < aContent.length; i++) {
|
|
96
|
+
var sType = oModifier.getControlType(aContent[i]);
|
|
97
|
+
if (aStopToken.indexOf(sType) > -1) {
|
|
98
|
+
iCurrentGroupIndex++;
|
|
99
|
+
if (iCurrentGroupIndex === iGroupIndex) {
|
|
100
|
+
oResult = aContent[i];
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return aContent.indexOf(oResult);
|
|
106
|
+
});
|
|
87
107
|
}
|
|
88
108
|
|
|
89
109
|
function isTitleOrToolbar(aElements, iIndex, oModifier) {
|
|
@@ -209,10 +229,19 @@ sap.ui.define([
|
|
|
209
229
|
}
|
|
210
230
|
|
|
211
231
|
function removeAndInsertAggregation(oModifier, oSimpleForm, MoveSimpleForm, aContentClone, oView) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
232
|
+
return Promise.resolve()
|
|
233
|
+
.then(oModifier.removeAllAggregation.bind(oModifier, oSimpleForm, MoveSimpleForm.CONTENT_AGGREGATION))
|
|
234
|
+
.then(function(){
|
|
235
|
+
return aContentClone.reduce(function(oPreviousPromise, oContentClone, iIndex) {
|
|
236
|
+
return oPreviousPromise
|
|
237
|
+
.then(oModifier.insertAggregation.bind(oModifier,
|
|
238
|
+
oSimpleForm,
|
|
239
|
+
MoveSimpleForm.CONTENT_AGGREGATION,
|
|
240
|
+
oContentClone,
|
|
241
|
+
iIndex,
|
|
242
|
+
oView));
|
|
243
|
+
}, Promise.resolve());
|
|
244
|
+
});
|
|
216
245
|
}
|
|
217
246
|
|
|
218
247
|
/**
|
|
@@ -226,103 +255,116 @@ sap.ui.define([
|
|
|
226
255
|
* @param {object} mPropertyBag
|
|
227
256
|
* Map containing the control modifier object (either sap.ui.core.util.reflection.JsControlTreeModifier or
|
|
228
257
|
* sap.ui.core.util.reflection.XmlTreeModifier), the view object where the controls are embedded and the application component
|
|
229
|
-
* @returns {
|
|
258
|
+
* @returns {Promise} Promise resolving when change is applied successfully
|
|
230
259
|
* @public
|
|
231
260
|
*/
|
|
232
261
|
MoveSimpleForm.applyChange = function(oChange, oSimpleForm, mPropertyBag) {
|
|
233
262
|
var oModifier = mPropertyBag.modifier;
|
|
234
263
|
var oView = mPropertyBag.view;
|
|
235
264
|
var oAppComponent = mPropertyBag.appComponent;
|
|
236
|
-
var oTargetGroup
|
|
265
|
+
var oTargetGroup;
|
|
266
|
+
var aContentClone;
|
|
267
|
+
var iMovedGroupIndex;
|
|
237
268
|
|
|
238
269
|
var oContent = oChange.getContent();
|
|
239
270
|
var mMovedElement = oContent.movedElements[0];
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
271
|
+
return Promise.resolve()
|
|
272
|
+
.then(function(){
|
|
273
|
+
return oModifier.getAggregation(oSimpleForm, MoveSimpleForm.CONTENT_AGGREGATION);
|
|
274
|
+
})
|
|
275
|
+
.then(function(aContent){
|
|
276
|
+
var aContentSelectors = aContent.map(function(oContentControl) {
|
|
277
|
+
return oModifier.getSelector(oContentControl, oAppComponent);
|
|
278
|
+
});
|
|
279
|
+
var mState = {content: aContentSelectors};
|
|
280
|
+
oChange.setRevertData(mState);
|
|
281
|
+
|
|
282
|
+
if (oChange.getChangeType() === MoveSimpleForm.CHANGE_TYPE_MOVE_FIELD) {
|
|
283
|
+
// !important: element was used in 1.40, do not remove for compatibility!
|
|
284
|
+
var oSourceField = oModifier.bySelector(mMovedElement.elementSelector || mMovedElement.element, oAppComponent, oView);
|
|
285
|
+
var iSourceFieldIndex = aContent.indexOf(oSourceField);
|
|
286
|
+
var iSourceFieldLength = getFieldLength(oModifier, aContent, iSourceFieldIndex);
|
|
287
|
+
|
|
288
|
+
// Compute the fields target index
|
|
289
|
+
// !important: groupId was used in 1.40, do not remove for compatibility!
|
|
290
|
+
oTargetGroup = oModifier.bySelector(mMovedElement.target.groupSelector || mMovedElement.target.groupId, oAppComponent, oView);
|
|
291
|
+
var iTargetGroupIndex = aContent.indexOf(oTargetGroup);
|
|
292
|
+
// !important: groupId was used in 1.40, do not remove for compatibility!
|
|
293
|
+
var oSourceGroup = oModifier.bySelector(mMovedElement.source.groupSelector || mMovedElement.source.groupId, oAppComponent, oView);
|
|
294
|
+
var iSourceGroupIndex = aContent.indexOf(oSourceGroup);
|
|
295
|
+
|
|
296
|
+
var iTargetFieldIndex = mapFieldIndexToContentAggregationIndex(oModifier, aContent, iTargetGroupIndex,
|
|
297
|
+
mMovedElement.target.fieldIndex, (iSourceGroupIndex === iTargetGroupIndex)
|
|
298
|
+
&& (mMovedElement.source.fieldIndex < mMovedElement.target.fieldIndex));
|
|
299
|
+
var iTargetFieldLength = getFieldLength(oModifier, aContent, iTargetFieldIndex);
|
|
300
|
+
|
|
301
|
+
aContentClone = aContent.slice();
|
|
302
|
+
var aFieldElements = aContentClone.slice(iSourceFieldIndex, iSourceFieldIndex + iSourceFieldLength);
|
|
303
|
+
|
|
304
|
+
var aSegmentBeforeSource, aSegmentBeforeTarget, aSegmentBetweenSourceAndTarget, aSegmentTillEnd;
|
|
305
|
+
if (iSourceFieldIndex < iTargetFieldIndex) {
|
|
306
|
+
aSegmentBeforeSource = aContentClone.slice(0, iSourceFieldIndex);
|
|
307
|
+
aSegmentBetweenSourceAndTarget = aContentClone.slice(iSourceFieldIndex + iSourceFieldLength, iTargetFieldIndex
|
|
308
|
+
+ iTargetFieldLength);
|
|
309
|
+
aSegmentTillEnd = aContentClone.slice(iTargetFieldIndex + iTargetFieldLength, aContentClone.length);
|
|
310
|
+
aContentClone = aSegmentBeforeSource.concat(aSegmentBetweenSourceAndTarget.concat(aFieldElements.concat(aSegmentTillEnd)));
|
|
311
|
+
} else if (iSourceFieldIndex > iTargetFieldIndex) {
|
|
312
|
+
aSegmentBeforeTarget = aContentClone.slice(0, iTargetFieldIndex + iTargetFieldLength);
|
|
313
|
+
aSegmentBetweenSourceAndTarget = aContentClone.slice(iTargetFieldIndex + iTargetFieldLength, iSourceFieldIndex);
|
|
314
|
+
aSegmentTillEnd = aContentClone.slice(iSourceFieldIndex + iSourceFieldLength, aContentClone.length);
|
|
315
|
+
aContentClone = aSegmentBeforeTarget.concat(aFieldElements.concat(aSegmentBetweenSourceAndTarget.concat(aSegmentTillEnd)));
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
if (iSourceFieldIndex != iTargetFieldIndex) {
|
|
319
|
+
return removeAndInsertAggregation(oModifier, oSimpleForm, MoveSimpleForm, aContentClone, oView);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
} else if (oChange.getChangeType() === MoveSimpleForm.CHANGE_TYPE_MOVE_GROUP) {
|
|
323
|
+
|
|
324
|
+
var aStopGroupToken = [MoveSimpleForm.sTypeTitle,
|
|
325
|
+
MoveSimpleForm.sTypeToolBar,
|
|
326
|
+
MoveSimpleForm.sTypeMTitle,
|
|
327
|
+
MoveSimpleForm.sTypeOverflowToolBar];
|
|
328
|
+
// !important: element was used in 1.40, do not remove for compatibility!
|
|
329
|
+
var oMovedGroup = oModifier.bySelector(mMovedElement.elementSelector || mMovedElement.element, oAppComponent, oView);
|
|
330
|
+
|
|
331
|
+
return Promise.resolve()
|
|
332
|
+
.then(function(){
|
|
333
|
+
// If needed, insert a Title for the first group.
|
|
334
|
+
if (mMovedElement.target.groupIndex === 0 || !oMovedGroup) {
|
|
335
|
+
return addTitleToFirstGroupIfNeeded(oChange, oModifier, aContent, oSimpleForm, mPropertyBag, aStopGroupToken, oContent.newControlId)
|
|
336
|
+
.then(function(aContentReturn) {
|
|
337
|
+
aContent = aContentReturn;
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
return undefined;
|
|
341
|
+
})
|
|
342
|
+
.then(function(){
|
|
343
|
+
iMovedGroupIndex = oMovedGroup ? aContent.indexOf(oMovedGroup) : 0;
|
|
344
|
+
return mapGroupIndexToContentAggregationIndex(oModifier, aStopGroupToken, aContent, mMovedElement.target.groupIndex);
|
|
345
|
+
})
|
|
346
|
+
.then(function(iTargetIndex){
|
|
347
|
+
oTargetGroup = aContent[iTargetIndex];
|
|
348
|
+
var iTargetLength = measureLengthOfSequenceUntilStopToken(oModifier, iTargetIndex, aContent, aStopGroupToken);
|
|
349
|
+
|
|
350
|
+
var iMovedLength = measureLengthOfSequenceUntilStopToken(oModifier, iMovedGroupIndex, aContent,
|
|
351
|
+
aStopGroupToken);
|
|
352
|
+
aContentClone = aContent.slice();
|
|
353
|
+
// Cut the moved group from the result array...
|
|
354
|
+
aContentClone.splice(iMovedGroupIndex, iMovedLength);
|
|
355
|
+
|
|
356
|
+
iTargetIndex = aContentClone.indexOf(oTargetGroup);
|
|
357
|
+
|
|
358
|
+
var iOffset = mMovedElement.source.groupIndex < mMovedElement.target.groupIndex ? iTargetLength : 0;
|
|
359
|
+
// and insert it at the target index
|
|
360
|
+
aContentClone = arrayRangeCopy(aContent, iMovedGroupIndex, aContentClone, iTargetIndex + iOffset, iMovedLength);
|
|
361
|
+
|
|
362
|
+
return removeAndInsertAggregation(oModifier, oSimpleForm, MoveSimpleForm, aContentClone, oView);
|
|
363
|
+
});
|
|
364
|
+
} else {
|
|
365
|
+
Log.warning("Unknown change type detected. Cannot apply to SimpleForm");
|
|
366
|
+
}
|
|
367
|
+
});
|
|
326
368
|
};
|
|
327
369
|
|
|
328
370
|
/**
|
|
@@ -392,7 +434,7 @@ sap.ui.define([
|
|
|
392
434
|
* @param {object} mPropertyBag
|
|
393
435
|
* Map containing the control modifier object (either sap.ui.core.util.reflection.JsControlTreeModifier or
|
|
394
436
|
* sap.ui.core.util.reflection.XmlTreeModifier), the view object where the controls are embedded and the application component
|
|
395
|
-
* @returns {
|
|
437
|
+
* @returns {Promise} Promise resolving when change is succesfully reverted
|
|
396
438
|
* @public
|
|
397
439
|
*/
|
|
398
440
|
MoveSimpleForm.revertChange = function(oChange, oSimpleForm, mPropertyBag) {
|
|
@@ -405,17 +447,19 @@ sap.ui.define([
|
|
|
405
447
|
var aContent = aContentSelectors.map(function(oSelector) {
|
|
406
448
|
return oModifier.bySelector(oSelector, oAppComponent, oView);
|
|
407
449
|
});
|
|
408
|
-
removeAndInsertAggregation(oModifier, oSimpleForm, MoveSimpleForm, aContent, oView)
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
450
|
+
return removeAndInsertAggregation(oModifier, oSimpleForm, MoveSimpleForm, aContent, oView)
|
|
451
|
+
.then(function(){
|
|
452
|
+
// destroy implicitly created title
|
|
453
|
+
var oCreatedTitleSelector = oRevertData.createdTitleSelector;
|
|
454
|
+
var oCreatedTitle = mPropertyBag.modifier.bySelector(oCreatedTitleSelector, mPropertyBag.appComponent);
|
|
455
|
+
if (oCreatedTitle) {
|
|
456
|
+
oCreatedTitle.destroy();
|
|
457
|
+
}
|
|
415
458
|
|
|
416
|
-
|
|
459
|
+
oChange.resetRevertData();
|
|
417
460
|
|
|
418
|
-
|
|
461
|
+
return true;
|
|
462
|
+
});
|
|
419
463
|
};
|
|
420
464
|
|
|
421
465
|
MoveSimpleForm.getChangeVisualizationInfo = function(oChange, oAppComponent) {
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
/*global sap */
|
|
8
|
-
|
|
9
7
|
sap.ui.define([
|
|
10
8
|
"sap/ui/fl/changeHandler/Base",
|
|
11
9
|
"sap/base/Log"
|
|
@@ -20,7 +18,7 @@ sap.ui.define([
|
|
|
20
18
|
*
|
|
21
19
|
* @alias sap.ui.layout.changeHandler.RenameFormContainer
|
|
22
20
|
* @author SAP SE
|
|
23
|
-
* @version 1.
|
|
21
|
+
* @version 1.93.2
|
|
24
22
|
* @since 1.48
|
|
25
23
|
* @private
|
|
26
24
|
* @experimental Since 1.48. This class is experimental and provides only limited functionality. Also the API might be changed in future.
|
|
@@ -39,31 +37,40 @@ sap.ui.define([
|
|
|
39
37
|
* @param {object} oControl The control which has been determined by the selector id
|
|
40
38
|
* @param {object} mPropertyBag Map containing the control modifier object (either sap.ui.core.util.reflection.JsControlTreeModifier or
|
|
41
39
|
* sap.ui.core.util.reflection.XmlTreeModifier), the view object where the controls are embedded and the application component
|
|
40
|
+
* @returns {Promise} Promise resolving when change is applied successfully
|
|
42
41
|
* @private
|
|
43
42
|
*/
|
|
44
43
|
RenameFormContainer.applyChange = function(oChangeWrapper, oControl, mPropertyBag) {
|
|
45
44
|
var oModifier = mPropertyBag.modifier,
|
|
46
45
|
oChangeDefinition = oChangeWrapper.getDefinition(),
|
|
47
|
-
oRenamedElement = oChangeWrapper.getDependentControl(_CONSTANTS.TARGET_ALIAS, mPropertyBag)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
46
|
+
oRenamedElement = oChangeWrapper.getDependentControl(_CONSTANTS.TARGET_ALIAS, mPropertyBag);
|
|
47
|
+
|
|
48
|
+
return Promise.resolve()
|
|
49
|
+
.then(function() {
|
|
50
|
+
return oModifier.getAggregation(oRenamedElement, "title");
|
|
51
|
+
})
|
|
52
|
+
.then(function(oTitle) {
|
|
53
|
+
if (oChangeDefinition.texts && oChangeDefinition.texts.formText && this._isProvided(oChangeDefinition.texts.formText.value)) {
|
|
54
|
+
|
|
55
|
+
var sValue = oChangeDefinition.texts.formText.value;
|
|
56
|
+
var oRevertDataPromise;
|
|
57
|
+
if (typeof oTitle === "string") {
|
|
58
|
+
oRevertDataPromise = Promise.resolve(oModifier.getProperty(oRenamedElement, "title")).then(function(sTitle) {
|
|
59
|
+
oChangeWrapper.setRevertData(sTitle);
|
|
60
|
+
oModifier.setProperty(oRenamedElement, "title", sValue);
|
|
61
|
+
});
|
|
62
|
+
} else {
|
|
63
|
+
oRevertDataPromise = Promise.resolve(oModifier.getProperty(oTitle, "text")).then(function(sText) {
|
|
64
|
+
oChangeWrapper.setRevertData(sText);
|
|
65
|
+
oModifier.setProperty(oTitle, "text", sValue);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return oRevertDataPromise;
|
|
69
|
+
} else {
|
|
70
|
+
Log.error("Change does not contain sufficient information to be applied: [" + oChangeDefinition.layer + "]" + oChangeDefinition.namespace + "/" + oChangeDefinition.fileName + "." + oChangeDefinition.fileType);
|
|
71
|
+
//however subsequent changes should be applied
|
|
72
|
+
}
|
|
73
|
+
}.bind(this));
|
|
67
74
|
};
|
|
68
75
|
|
|
69
76
|
/**
|
|
@@ -99,23 +106,26 @@ sap.ui.define([
|
|
|
99
106
|
* @param {object} mPropertyBag.modifier Modifier for the controls
|
|
100
107
|
* @param {object} mPropertyBag.appComponent Component in which the change should be applied
|
|
101
108
|
* @param {object} mPropertyBag.view Application view
|
|
102
|
-
* @returns {
|
|
109
|
+
* @returns {Promise} Promise resolving when change is successfully reverted
|
|
103
110
|
* @public
|
|
104
111
|
*/
|
|
105
112
|
RenameFormContainer.revertChange = function(oChangeWrapper, oControl, mPropertyBag) {
|
|
106
113
|
var sOldText = oChangeWrapper.getRevertData(),
|
|
107
114
|
oModifier = mPropertyBag.modifier,
|
|
108
|
-
oRenamedElement = oChangeWrapper.getDependentControl(_CONSTANTS.TARGET_ALIAS, mPropertyBag)
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
oRenamedElement = oChangeWrapper.getDependentControl(_CONSTANTS.TARGET_ALIAS, mPropertyBag);
|
|
116
|
+
|
|
117
|
+
return Promise.resolve()
|
|
118
|
+
.then(function() {
|
|
119
|
+
return oModifier.getAggregation(oRenamedElement, "title");
|
|
120
|
+
})
|
|
121
|
+
.then(function(oTitle) {
|
|
122
|
+
if (typeof oTitle === "string") {
|
|
123
|
+
oModifier.setProperty(oRenamedElement, "title", sOldText);
|
|
124
|
+
} else {
|
|
125
|
+
oModifier.setProperty(oTitle, "text", sOldText);
|
|
126
|
+
}
|
|
127
|
+
oChangeWrapper.resetRevertData();
|
|
128
|
+
});
|
|
119
129
|
};
|
|
120
130
|
|
|
121
131
|
RenameFormContainer._isProvided = function(sString){
|
|
@@ -22,7 +22,7 @@ sap.ui.define([
|
|
|
22
22
|
*
|
|
23
23
|
* @alias sap.ui.layout.changeHandler.RenameForm
|
|
24
24
|
* @author SAP SE
|
|
25
|
-
* @version 1.
|
|
25
|
+
* @version 1.93.2
|
|
26
26
|
* @since 1.40
|
|
27
27
|
* @private
|
|
28
28
|
* @experimental Since 1.40. This class is experimental and provides only limited functionality. Also the API might be changed in future.
|
|
@@ -36,6 +36,7 @@ sap.ui.define([
|
|
|
36
36
|
* @param {object} oControl - the control which has been determined by the selector id
|
|
37
37
|
* @param {object} mPropertyBag - map containing the control modifier object (either sap.ui.core.util.reflection.JsControlTreeModifier or
|
|
38
38
|
* sap.ui.core.util.reflection.XmlTreeModifier), the view object where the controls are embedded and the application component
|
|
39
|
+
* @returns {Promise} Promise resolving when change is successfully applied
|
|
39
40
|
* @private
|
|
40
41
|
*/
|
|
41
42
|
RenameForm.applyChange = function(oChangeWrapper, oControl, mPropertyBag) {
|
|
@@ -51,17 +52,22 @@ sap.ui.define([
|
|
|
51
52
|
|
|
52
53
|
if (oChangeDefinition.texts && oChangeDefinition.texts.formText && this._isProvided(oChangeDefinition.texts.formText.value)) {
|
|
53
54
|
if (!oControl) {
|
|
54
|
-
|
|
55
|
+
return Promise.reject(new Error("no Control provided for renaming"));
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
return Promise.resolve()
|
|
59
|
+
.then(function() {
|
|
60
|
+
return oModifier.getProperty(oRenamedElement, "text");
|
|
61
|
+
})
|
|
62
|
+
.then(function(sProperty) {
|
|
63
|
+
oChangeWrapper.setRevertData(sProperty);
|
|
64
|
+
var sValue = oChangeDefinition.texts.formText.value;
|
|
65
|
+
oModifier.setProperty(oRenamedElement, "text", sValue);
|
|
66
|
+
});
|
|
62
67
|
} else {
|
|
63
68
|
Log.error("Change does not contain sufficient information to be applied: [" + oChangeDefinition.layer + "]" + oChangeDefinition.namespace + "/" + oChangeDefinition.fileName + "." + oChangeDefinition.fileType);
|
|
64
69
|
//however subsequent changes should be applied
|
|
70
|
+
return Promise.resolve();
|
|
65
71
|
}
|
|
66
72
|
};
|
|
67
73
|
|
|
@@ -72,7 +78,6 @@ sap.ui.define([
|
|
|
72
78
|
* @param {sap.ui.core.Control} oControl Control that matches the change selector for applying the change
|
|
73
79
|
* @param {object} mPropertyBag property bag
|
|
74
80
|
* @param {object} mPropertyBag.modifier modifier for the controls
|
|
75
|
-
* @returns {boolean} true if successful
|
|
76
81
|
* @public
|
|
77
82
|
*/
|
|
78
83
|
RenameForm.revertChange = function(oChangeWrapper, oControl, mPropertyBag) {
|
|
@@ -91,7 +96,6 @@ sap.ui.define([
|
|
|
91
96
|
// In some cases the SimpleForm does not properly update the value, so the invalidate call is required
|
|
92
97
|
oRenamedElement.getParent().invalidate();
|
|
93
98
|
oChangeWrapper.resetRevertData();
|
|
94
|
-
return true;
|
|
95
99
|
} else {
|
|
96
100
|
Log.error("Change doesn't contain sufficient information to be reverted. Most Likely the Change didn't go through applyChange.");
|
|
97
101
|
}
|