@sapui5/sap.suite.ui.generic.template 1.108.18 → 1.108.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapui5/sap.suite.ui.generic.template",
3
- "version": "1.108.18",
3
+ "version": "1.108.19",
4
4
  "description": "SAPUI5 Library sap.suite.ui.generic.template",
5
5
  "keywords": [
6
6
  "sapui5",
@@ -7,7 +7,7 @@
7
7
 
8
8
  (c) Copyright 2009-2015 SAP SE. All rights reserved
9
9
  </copyright>
10
- <version>1.108.18</version>
10
+ <version>1.108.19</version>
11
11
 
12
12
  <documentation>Library with generic Suite UI templates.</documentation>
13
13
 
@@ -634,13 +634,19 @@ sap.ui.define([
634
634
  });
635
635
  }
636
636
  }
637
-
638
- function fnOnSmartTablePaste(oEvent) {
639
- var aParsedData;
640
- var oSmartTable = oEvent.getSource();
637
+
638
+ // returns the Create button for the given SmartTable if it exists (otherwise a faulty value is returned)
639
+ function getCreateButtonForTable(oSmartTable){
641
640
  var sSmartTableId = oSmartTable.getId();
642
641
  var sAddEntryId = sSmartTableId.split("::Table")[0] + "::addEntry";
643
642
  var oAddEntry = oController.byId(sAddEntryId); //Instance of the Create button
643
+ return oAddEntry;
644
+ }
645
+
646
+ function fnOnSmartTablePaste(oEvent) {
647
+ var aParsedData;
648
+ var oSmartTable = oEvent.getSource();
649
+ var oAddEntry = getCreateButtonForTable(oSmartTable);
644
650
  var bIsInlineCreationRowsEnabled = fnIsInlineCreationRowsEnabled(oSmartTable);
645
651
  //Paste is allowed when an add button is present in the table (or) inline creation rows feature is enabled
646
652
  var bIsPasteAllowed = oAddEntry || bIsInlineCreationRowsEnabled;
@@ -1410,7 +1416,6 @@ sap.ui.define([
1410
1416
  return false;
1411
1417
  }
1412
1418
  oSelectedSection = oControl;
1413
- oObjectPage.setSelectedSection(oSelectedSection);
1414
1419
  return null;
1415
1420
  }
1416
1421
  if (controlHelper.isObjectPageSubSection(oControl)){
@@ -1421,32 +1426,33 @@ sap.ui.define([
1421
1426
  return false;
1422
1427
  }
1423
1428
  // Scroll to thwe given subsection and make sure that controls and bindings for this subsection are initialized (necessary because of lazy loading)
1424
- oSelectedSection.setSelectedSubSection(oControl);
1425
1429
  fnSubSectionEntered(oControl);
1426
- // Maybe we can already make the decision on the subsection level
1427
- var oSubSectionDomRef = oControl.getDomRef();
1428
- var oFirstFocusableInput = getFirstEditableInput(oSubSectionDomRef);
1429
- if (oFirstFocusableInput && oFirstFocusableInput.type !== "checkbox"){
1430
- var oUI5Control = controlHelper.getUI5ControlForDomElement(oFirstFocusableInput);
1431
- if (!oUI5Control){
1432
- return null;
1433
- }
1434
- var oSmartField;
1435
- var bIsVisible = controlHelper.isElementVisibleOnView(oUI5Control.getId(), oController.getView(), function(oParent){
1436
- if (controlHelper.isSmartField(oParent)){
1437
- oSmartField = oParent;
1438
- }
1439
- });
1440
- if (!bIsVisible){
1441
- return null;
1442
- }
1443
- return oSmartField ? fnFocusSmartFieldForInput(oSmartField, null) : oUI5Control;
1444
- }
1430
+ oObjectPage.setSelectedSection(oSelectedSection);
1431
+ oSelectedSection.setSelectedSubSection(oControl);
1445
1432
  return null;
1446
1433
  }
1447
1434
  if (controlHelper.isSmartField(oControl)){ // check whether the SmartField is the correct target for focussing
1448
1435
  return fnFocusSmartFieldForInput(oControl, false);
1449
1436
  }
1437
+ if (controlHelper.isSmartTable(oControl)){
1438
+ var oPresentationControl = oTemplateUtils.oServices.oPresentationControlHandlerFactory.getPresentationControlHandler(oControl);
1439
+ var oFirstEditableCellPromise = oPresentationControl.getFirstFocussableEditableCellPromise();
1440
+ return oFirstEditableCellPromise.then(function(oEditableCell){
1441
+ if (oEditableCell){
1442
+ return oEditableCell;
1443
+ }
1444
+ if (oTemplateUtils.oComponentUtils.isDraftEnabled()) {
1445
+ var oCreateButton = getCreateButtonForTable(oControl);
1446
+ if (oCreateButton){
1447
+ if (oCreateButton.isFocusable()){
1448
+ return oCreateButton;
1449
+ } // If the Create button is not focussable it still could be part of the Overflow button still open what to do then
1450
+ }
1451
+ }
1452
+ return false;
1453
+ });
1454
+
1455
+ }
1450
1456
  return null;
1451
1457
  });
1452
1458
  return Promise.resolve(oRet).then(function(oTargetControl){
@@ -1,4 +1,4 @@
1
- sap.ui.define(["sap/suite/ui/generic/template/genericUtilities/FeLogger"], function(FeLogger) {
1
+ sap.ui.define(["sap/ui/dom/getFirstEditableInput", "sap/suite/ui/generic/template/genericUtilities/FeLogger"], function(getFirstEditableInput, FeLogger) {
2
2
  "use strict";
3
3
 
4
4
  var oFeLogger = new FeLogger("genericUtilities.controlHelper");
@@ -46,6 +46,17 @@ sap.ui.define(["sap/suite/ui/generic/template/genericUtilities/FeLogger"], funct
46
46
  focusUI5Control(oTarget, oFocusInfo);
47
47
  }
48
48
 
49
+ // returns a Promise that resolves to the boolean information whether the SmartField is a possible focus target for input.
50
+ function getSmartFieldIsFocussableForInputPromise(oSmartField){
51
+ var oSmartFieldMetadataAvailablePromise = oSmartField._getComputedMetadata();
52
+ return oSmartFieldMetadataAvailablePromise.then(function(){
53
+ return (oSmartField.getMode() === "edit") && (oSmartField._getICRenderedPromise() || Promise.resolve()).then(function(){
54
+ var oFirstFocusableInput = getFirstEditableInput(oSmartField.getDomRef());
55
+ return !(!oFirstFocusableInput || oFirstFocusableInput.type === "checkbox");
56
+ });
57
+ });
58
+ }
59
+
49
60
  // returns the UI5 control which currently has the focus, if there is one. Otherwise returns a faulty value.
50
61
  // Implementation as recommended by UI5 until the provide an own abstraction.
51
62
  function getControlWithFocus(){
@@ -91,7 +102,10 @@ sap.ui.define(["sap/suite/ui/generic/template/genericUtilities/FeLogger"], funct
91
102
  }
92
103
  if (oControlHelper.isObjectPageSubSection(oControl)){
93
104
  return oControl.getBlocks().concat(oControl.getMoreBlocks());
94
- }
105
+ }
106
+ if (oControlHelper.isColumnListItem(oControl)){
107
+ return oControl.getCells();
108
+ }
95
109
  return [];
96
110
  }
97
111
 
@@ -117,7 +131,7 @@ sap.ui.define(["sap/suite/ui/generic/template/genericUtilities/FeLogger"], funct
117
131
  return -1;
118
132
  }
119
133
  }
120
- return (oChild1.getId() < oChild2.getId()) ? -1 : 1; // if we cannot determine a reasonable order we still want to have a reproducable order
134
+ return 1 - 2 * (!oDomRef1 === !oDomRef2 ? oChild1.getId() < oChild2.getId() : !oDomRef2); // if we cannot determine a reasonable order we still want to have a reproducable order. Note that elements with DomRef must clearly be separated from those without.
121
135
  }
122
136
  return (iPos1 >= 0 && iPos2 >= 0) ? (iPos1 - iPos2) : (iPos2 - iPos1); // if only one child has been identified in the list of children it takes precedence.
123
137
  }
@@ -164,8 +178,8 @@ sap.ui.define(["sap/suite/ui/generic/template/genericUtilities/FeLogger"], funct
164
178
  var aChildren = getChildren(oElement);
165
179
  if (aChildren.length === 0){
166
180
  aChildren = oElement.findElements(false);
181
+ aChildren.sort(fnSortChildControls.bind(null, oElement));
167
182
  }
168
- aChildren.sort(fnSortChildControls.bind(null, oElement));
169
183
  aChildren.some(function(oChild){
170
184
  vResult = fnSearchInTree(mAlreadyAnalyzed, oChild, fnHandleElement);
171
185
  return vResult; // If vResult is truthy it is either a Promise (which makes the processing asynchronous) or the result of fnSearchInTree. In both cases we should stop now.
@@ -209,6 +223,7 @@ sap.ui.define(["sap/suite/ui/generic/template/genericUtilities/FeLogger"], funct
209
223
  isOverflowToolbar: isControlOfType.bind(null, "sap/m/OverflowToolbar"),
210
224
  isMultiInputField: isControlOfType.bind(null, "sap/m/MultiInput"),
211
225
  isLink: isControlOfType.bind(null, "sap/m/Link"),
226
+ isColumnListItem: isControlOfType.bind(null, "sap/m/ColumnListItem"),
212
227
  isDynamicPage: isControlOfType.bind(null, "sap/f/DynamicPage"),
213
228
  isObjectPageSection: isControlOfType.bind(null, "sap/uxap/ObjectPageSection"),
214
229
  isObjectPageSubSection: isControlOfType.bind(null, "sap/uxap/ObjectPageSubSection"),
@@ -218,6 +233,7 @@ sap.ui.define(["sap/suite/ui/generic/template/genericUtilities/FeLogger"], funct
218
233
  focusUI5Control: focusUI5Control,
219
234
  focusDom: focusDom,
220
235
  getControlWithFocus: getControlWithFocus,
236
+ getSmartFieldIsFocussableForInputPromise: getSmartFieldIsFocussableForInputPromise,
221
237
  isElementVisibleOnView: isElementVisibleOnView,
222
238
  sortChildControls: fnSortChildControls,
223
239
  searchInTree: fnSearchInTree.bind(null, null)
@@ -854,7 +854,7 @@ sap.ui.define([
854
854
  * @extends sap.ui.core.UIComponent
855
855
  * @abstract
856
856
  * @author SAP SE
857
- * @version 1.108.18
857
+ * @version 1.108.19
858
858
  * @name sap.suite.ui.generic.template.lib.AppComponent
859
859
  */
860
860
  return UIComponent.extend("sap.suite.ui.generic.template.lib.AppComponent", {
@@ -2942,7 +2942,7 @@ sap.ui.define(["sap/ui/base/Object",
2942
2942
  * @param {sap.suite.ui.generic.template.lib.AppComponent} oAppComponent The AppComponent instance
2943
2943
  * @public
2944
2944
  * @extends sap.ui.base.Object
2945
- * @version 1.108.18
2945
+ * @version 1.108.19
2946
2946
  * @since 1.30.0
2947
2947
  * @alias sap.suite.ui.generic.template.lib.NavigationController
2948
2948
  */
@@ -1,10 +1,11 @@
1
1
  sap.ui.define([
2
2
  "sap/ui/base/Object",
3
3
  "sap/base/util/extend",
4
+ "sap/ui/model/base/ManagedObjectModel",
4
5
  "sap/ui/dom/getFirstEditableInput",
5
6
  "sap/suite/ui/generic/template/genericUtilities/controlHelper",
6
7
  "sap/suite/ui/generic/template/genericUtilities/testableHelper"
7
- ], function(BaseObject, extend, getFirstEditableInput, controlHelper, testableHelper) {
8
+ ], function(BaseObject, extend, ManagedObjectModel, getFirstEditableInput, controlHelper, testableHelper) {
8
9
  "use strict";
9
10
 
10
11
  function getMethods(oController, oCommonUtils, oComponentUtils, oSmartTable) {
@@ -265,7 +266,21 @@ sap.ui.define([
265
266
  }, 0);
266
267
  }
267
268
  }
268
- }
269
+ }
270
+
271
+ function getFirstFocussableEditableCellPromise(){
272
+ return new Promise(function(fnResolve, fnReject){
273
+ fnExecuteWhenUnbusy(function(){
274
+ Promise.resolve(controlHelper.searchInTree(oInnerTable, function(oControl){
275
+ if (controlHelper.isSmartField(oControl)){ // check whether the SmartField is the correct target for focussing
276
+ return controlHelper.getSmartFieldIsFocussableForInputPromise(oControl).then(function(bIsFocussable){
277
+ return bIsFocussable && oControl; // If the SmartField has turned out to be focussable take it. Otherwise no need to investigate the subtree below it.
278
+ });
279
+ }
280
+ })).then(fnResolve);
281
+ });
282
+ });
283
+ }
269
284
 
270
285
  function getThreshold(){
271
286
  return bIsMTable ? oInnerTable.getGrowingThreshold() : oInnerTable.getThreshold();
@@ -282,6 +297,21 @@ sap.ui.define([
282
297
  function getToolbar(){
283
298
  return oSmartTable.getToolbar();
284
299
  }
300
+
301
+ function fnExecuteWhenUnbusy(fnExecute){
302
+ if (!oInnerTable.getBusy()){
303
+ fnExecute();
304
+ return;
305
+ }
306
+ var oMOM = new ManagedObjectModel(oInnerTable);
307
+ var oBusyBinding = oMOM.bindProperty("/busy");
308
+ var fnChangeHandler = function(){
309
+ oMOM.destroy();
310
+ fnExecuteWhenUnbusy(fnExecute);
311
+ };
312
+ oBusyBinding.attachChange(fnChangeHandler);
313
+ }
314
+
285
315
  // public instance methods
286
316
  return {
287
317
  getBinding: fnGetBinding,
@@ -301,6 +331,7 @@ sap.ui.define([
301
331
  rebind: fnRebind,
302
332
  applyNavigationSortOrder: fnApplyNavigationSortOrder,
303
333
  scrollToSelectedItemAsPerChildContext: fnScrollToSelectedItemAsPerChildContext,
334
+ getFirstFocussableEditableCellPromise: getFirstFocussableEditableCellPromise,
304
335
  setFocusOnFirstEditableFieldInTableRow: fnSetFocusOnFirstEditableFieldInTableRow,
305
336
  getThreshold: getThreshold,
306
337
  getDataStateIndicator: getDataStateIndicator,
@@ -38,7 +38,7 @@ sap.ui.define(['sap/ui/core/Core', 'sap/ui/core/library','sap/fe/placeholder/lib
38
38
  interfaces: [],
39
39
  controls: [],
40
40
  elements: [],
41
- version: "1.108.18",
41
+ version: "1.108.19",
42
42
  extensions: {
43
43
  //Configuration used for rule loading of Support Assistant
44
44
  "sap.ui.support": {