@sapui5/sap.fe.core 1.96.0 → 1.97.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 (96) hide show
  1. package/package.json +5 -5
  2. package/src/sap/fe/core/.library +1 -1
  3. package/src/sap/fe/core/AnnotationHelper.js +2 -2
  4. package/src/sap/fe/core/CommonUtils.js +59 -274
  5. package/src/sap/fe/core/RouterProxy.js +52 -64
  6. package/src/sap/fe/core/TemplateComponent.js +2 -2
  7. package/src/sap/fe/core/TransactionHelper.js +18 -22
  8. package/src/sap/fe/core/actions/messageHandling.js +80 -4
  9. package/src/sap/fe/core/actions/operations.js +42 -23
  10. package/src/sap/fe/core/controllerextensions/EditFlow.js +36 -21
  11. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +9 -3
  12. package/src/sap/fe/core/controllerextensions/InternalRouting.js +20 -50
  13. package/src/sap/fe/core/controllerextensions/MessageHandler.js +222 -102
  14. package/src/sap/fe/core/controllerextensions/ViewState.js +33 -6
  15. package/src/sap/fe/core/controls/CustomQuickViewPage.js +109 -111
  16. package/src/sap/fe/core/controls/filterbar.d.js +8 -0
  17. package/src/sap/fe/core/controls/filterbar.d.ts +0 -0
  18. package/src/sap/fe/core/converters/ManifestSettings.js +2 -1
  19. package/src/sap/fe/core/converters/ManifestSettings.ts +4 -1
  20. package/src/sap/fe/core/converters/MetaModelConverter.js +10 -1
  21. package/src/sap/fe/core/converters/MetaModelConverter.ts +9 -1
  22. package/src/sap/fe/core/converters/annotations/DataField.js +2 -2
  23. package/src/sap/fe/core/converters/annotations/DataField.ts +1 -1
  24. package/src/sap/fe/core/converters/common/AnnotationConverter.js +67 -40
  25. package/src/sap/fe/core/converters/controls/Common/Action.js +6 -3
  26. package/src/sap/fe/core/converters/controls/Common/Action.ts +6 -3
  27. package/src/sap/fe/core/converters/controls/Common/Form.js +57 -18
  28. package/src/sap/fe/core/converters/controls/Common/Form.ts +51 -13
  29. package/src/sap/fe/core/converters/controls/Common/Table.js +130 -19
  30. package/src/sap/fe/core/converters/controls/Common/Table.ts +139 -18
  31. package/src/sap/fe/core/converters/helpers/ID.js +9 -1
  32. package/src/sap/fe/core/converters/helpers/ID.ts +4 -0
  33. package/src/sap/fe/core/converters/templates/ListReportConverter.js +18 -7
  34. package/src/sap/fe/core/converters/templates/ListReportConverter.ts +17 -12
  35. package/src/sap/fe/core/designtime/AppComponent.designtime.js +2 -1
  36. package/src/sap/fe/core/formatters/TableFormatter.js +27 -4
  37. package/src/sap/fe/core/formatters/TableFormatter.ts +20 -3
  38. package/src/sap/fe/core/helpers/KeepAliveHelper.js +211 -0
  39. package/src/sap/fe/core/helpers/KeepAliveHelper.ts +202 -0
  40. package/src/sap/fe/core/helpers/KeepAliveRefreshTypes.js +32 -0
  41. package/src/sap/fe/core/helpers/KeepAliveRefreshTypes.ts +36 -0
  42. package/src/sap/fe/core/helpers/ModelHelper.js +51 -0
  43. package/src/sap/fe/core/library.js +1 -1
  44. package/src/sap/fe/core/messagebundle.properties +15 -1
  45. package/src/sap/fe/core/messagebundle_ar.properties +10 -0
  46. package/src/sap/fe/core/messagebundle_bg.properties +10 -0
  47. package/src/sap/fe/core/messagebundle_ca.properties +10 -0
  48. package/src/sap/fe/core/messagebundle_cs.properties +10 -0
  49. package/src/sap/fe/core/messagebundle_cy.properties +10 -0
  50. package/src/sap/fe/core/messagebundle_da.properties +10 -0
  51. package/src/sap/fe/core/messagebundle_de.properties +10 -0
  52. package/src/sap/fe/core/messagebundle_el.properties +10 -0
  53. package/src/sap/fe/core/messagebundle_en.properties +10 -0
  54. package/src/sap/fe/core/messagebundle_en_GB.properties +10 -0
  55. package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +6 -0
  56. package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +11 -1
  57. package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +11 -1
  58. package/src/sap/fe/core/messagebundle_es.properties +10 -0
  59. package/src/sap/fe/core/messagebundle_es_MX.properties +10 -0
  60. package/src/sap/fe/core/messagebundle_et.properties +10 -0
  61. package/src/sap/fe/core/messagebundle_fi.properties +10 -0
  62. package/src/sap/fe/core/messagebundle_fr.properties +10 -0
  63. package/src/sap/fe/core/messagebundle_fr_CA.properties +10 -0
  64. package/src/sap/fe/core/messagebundle_hi.properties +10 -0
  65. package/src/sap/fe/core/messagebundle_hr.properties +10 -0
  66. package/src/sap/fe/core/messagebundle_hu.properties +10 -0
  67. package/src/sap/fe/core/messagebundle_id.properties +11 -1
  68. package/src/sap/fe/core/messagebundle_it.properties +10 -0
  69. package/src/sap/fe/core/messagebundle_iw.properties +10 -0
  70. package/src/sap/fe/core/messagebundle_ja.properties +19 -9
  71. package/src/sap/fe/core/messagebundle_kk.properties +10 -0
  72. package/src/sap/fe/core/messagebundle_ko.properties +10 -0
  73. package/src/sap/fe/core/messagebundle_lt.properties +10 -0
  74. package/src/sap/fe/core/messagebundle_lv.properties +10 -0
  75. package/src/sap/fe/core/messagebundle_ms.properties +10 -0
  76. package/src/sap/fe/core/messagebundle_nl.properties +10 -0
  77. package/src/sap/fe/core/messagebundle_no.properties +10 -0
  78. package/src/sap/fe/core/messagebundle_pl.properties +10 -0
  79. package/src/sap/fe/core/messagebundle_pt.properties +11 -1
  80. package/src/sap/fe/core/messagebundle_pt_PT.properties +10 -0
  81. package/src/sap/fe/core/messagebundle_ro.properties +10 -0
  82. package/src/sap/fe/core/messagebundle_ru.properties +10 -0
  83. package/src/sap/fe/core/messagebundle_sh.properties +10 -0
  84. package/src/sap/fe/core/messagebundle_sk.properties +10 -0
  85. package/src/sap/fe/core/messagebundle_sl.properties +10 -0
  86. package/src/sap/fe/core/messagebundle_sv.properties +10 -0
  87. package/src/sap/fe/core/messagebundle_th.properties +10 -0
  88. package/src/sap/fe/core/messagebundle_tr.properties +10 -0
  89. package/src/sap/fe/core/messagebundle_uk.properties +10 -0
  90. package/src/sap/fe/core/messagebundle_vi.properties +10 -0
  91. package/src/sap/fe/core/messagebundle_zh_CN.properties +10 -0
  92. package/src/sap/fe/core/messagebundle_zh_TW.properties +10 -0
  93. package/src/sap/fe/core/services/RoutingServiceFactory.js +30 -19
  94. package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +1 -1
  95. package/src/sap/fe/core/templating/EntitySetHelper.js +80 -7
  96. package/src/sap/fe/core/templating/EntitySetHelper.ts +42 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapui5/sap.fe.core",
3
- "version": "1.96.0",
3
+ "version": "1.97.0",
4
4
  "description": "SAPUI5 Library sap.fe.core",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "SAP SE (https://www.sap.com)",
@@ -10,9 +10,9 @@
10
10
  "build-local": "tsc --project tsconfig-local.json && copyfiles -u 6 \"../../node_modules/@sap-ux/annotation-converter/ui5-dist/**/*.js\" dist-local/src && copyfiles ui5.yaml dist-local",
11
11
  "copy-dependency": "copyfiles -u 6 \"../../node_modules/@sap-ux/annotation-converter/ui5-dist/**/*.js\" target/classes/META-INF/resources",
12
12
  "prepare-npm-sources": "copyfiles -u 6 \"../../node_modules/@sap-ux/annotation-converter/ui5-dist/**/*.js\" target/npm-sources/src && babel target/npm-sources/src --out-dir target/npm-sources/src --extensions \".ts\" --config-file ../../.babelrc",
13
- "test": "jest --detectOpenHandles --forceExit",
14
- "test-refs": "jest --detectOpenHandles --forceExit --config jest.config-refs.js",
15
- "test-updateSnapshots": "jest --detectOpenHandles --forceExit -u",
13
+ "test": "jest",
14
+ "test-refs": "jest --config jest.config-refs.js",
15
+ "test-updateSnapshots": "jest -u",
16
16
  "watch-local": "npm run build-local && tsc --project tsconfig-local.json --watch"
17
17
  },
18
18
  "keywords": [
@@ -21,7 +21,7 @@
21
21
  ],
22
22
  "devDependencies": {
23
23
  "@babel/cli": "^7.14.8",
24
- "@ui5/cli": "^2.10.0",
24
+ "@ui5/cli": "^2.14.0",
25
25
  "copyfiles": "2.2.0"
26
26
  }
27
27
  }
@@ -6,7 +6,7 @@
6
6
  <copyright>SAP UI development toolkit for HTML5 (SAPUI5)
7
7
  (c) Copyright 2009-2021 SAP SE. All rights reserved
8
8
  </copyright>
9
- <version>1.96.0</version>
9
+ <version>1.97.0</version>
10
10
 
11
11
  <documentation>UI5 library: sap.fe.core</documentation>
12
12
 
@@ -362,8 +362,8 @@ sap.ui.define(
362
362
  buildActionWrapper: function(oAction, oThis) {
363
363
  var aParams = [
364
364
  "$event",
365
- CommonHelper.addSingleQuotes(oAction.handlerModule),
366
- CommonHelper.addSingleQuotes(oAction.handlerMethod)
365
+ CommonHelper.addSingleQuotes(oAction.handlerModule, true),
366
+ CommonHelper.addSingleQuotes(oAction.handlerMethod, true)
367
367
  ];
368
368
 
369
369
  if (oThis && oThis.id) {
@@ -77,9 +77,31 @@ sap.ui.define(
77
77
  ];
78
78
 
79
79
  /**
80
- * Returns the actual property type of a given datafield or property.
80
+ * Method to split the search term on spaces and wrap each word in double quotes.
81
81
  *
82
- * @param {sap.ui.model.Context} oNavigationContext The metamodel context
82
+ * @param {string} sSearchTerm The search term
83
+ * @returns {string|undefined} The normalized search term, undefined if empty
84
+ */
85
+ function normalizeSearchTerm(sSearchTerm) {
86
+ if (!sSearchTerm) {
87
+ return undefined;
88
+ }
89
+
90
+ return sSearchTerm
91
+ .replace(/"/g, " ")
92
+ .split(/\s+/)
93
+ .reduce(function(sNormalized, sCurrentWord) {
94
+ if (sCurrentWord !== "") {
95
+ sNormalized = (sNormalized ? sNormalized + " " : "") + '"' + sCurrentWord + '"';
96
+ }
97
+ return sNormalized;
98
+ }, undefined);
99
+ }
100
+
101
+ /**
102
+ * Returns the actual property type of a given data field or property.
103
+ *
104
+ * @param {sap.ui.model.Context} oNavigationContext The MetaModel context
83
105
  * @returns {string} The name of the actual data type
84
106
  */
85
107
  function getPropertyDataType(oNavigationContext) {
@@ -1645,32 +1667,37 @@ sap.ui.define(
1645
1667
  }
1646
1668
 
1647
1669
  /**
1648
- * Sets the FLP user defaults.
1670
+ * Defines the user default settings for the SAP Fiori Launchpad.
1649
1671
  *
1650
1672
  * @function
1651
1673
  * @name sap.fe.core.CommonUtils.setUserDefaults
1652
1674
  * @memberof sap.fe.core.CommonUtils
1653
1675
  * @param {object} [oAppComponent] The AppComponent
1654
1676
  * @param {Array} [aParameters] Parameters in the dialog
1655
- * @param {object} [oModel] Model to which the default value has to be set
1677
+ * @param {object} [oModel] Model for which the default value has to be set
1656
1678
  * @param {boolean} [bIsAction] `true` if aParameters contains action parameters
1679
+ * @param {boolean} [bIsCreate] `true` if preferredMode is 'create'
1680
+ * @param {object} [oActionDefaultValues] Inbound Create Parameters from the Manifest
1657
1681
  * @returns {Promise}
1658
1682
  * @ui5-restricted
1659
1683
  * @final
1660
1684
  **/
1661
- function setUserDefaults(oAppComponent, aParameters, oModel, bIsAction) {
1685
+ function setUserDefaults(oAppComponent, aParameters, oModel, bIsAction, bIsCreate, oActionDefaultValues) {
1662
1686
  return new Promise(function(resolve, reject) {
1663
1687
  var oComponentData = oAppComponent.getComponentData(),
1664
1688
  oStartupParameters = (oComponentData && oComponentData.startupParameters) || {},
1665
1689
  oShellServices = oAppComponent.getShellServices();
1666
-
1667
1690
  if (!oShellServices.hasUShell()) {
1668
1691
  aParameters.map(function(oParameter) {
1669
1692
  var sPropertyName = bIsAction
1670
1693
  ? "/" + oParameter.$Name
1671
1694
  : oParameter.getPath().slice(oParameter.getPath().lastIndexOf("/") + 1);
1672
1695
  var sParameterName = bIsAction ? sPropertyName.slice(1) : sPropertyName;
1673
- if (oStartupParameters[sParameterName]) {
1696
+ if (oActionDefaultValues && bIsCreate) {
1697
+ if (oActionDefaultValues[sParameterName]) {
1698
+ oModel.setProperty(sPropertyName, oActionDefaultValues[sParameterName]);
1699
+ }
1700
+ } else if (oStartupParameters[sParameterName]) {
1674
1701
  oModel.setProperty(sPropertyName, oStartupParameters[sParameterName][0]);
1675
1702
  }
1676
1703
  });
@@ -1684,7 +1711,11 @@ sap.ui.define(
1684
1711
  ? "/" + oParameter.$Name
1685
1712
  : oParameter.getPath().slice(oParameter.getPath().lastIndexOf("/") + 1);
1686
1713
  var sParameterName = bIsAction ? sPropertyName.slice(1) : sPropertyName;
1687
- if (oStartupParameters[sParameterName]) {
1714
+ if (oActionDefaultValues && bIsCreate) {
1715
+ if (oActionDefaultValues[sParameterName]) {
1716
+ oModel.setProperty(sPropertyName, oActionDefaultValues[sParameterName]);
1717
+ }
1718
+ } else if (oStartupParameters[sParameterName]) {
1688
1719
  oModel.setProperty(sPropertyName, oStartupParameters[sParameterName][0]);
1689
1720
  } else if (aExtendedParameters.length > 0) {
1690
1721
  for (var i in aExtendedParameters) {
@@ -1703,6 +1734,24 @@ sap.ui.define(
1703
1734
  });
1704
1735
  }
1705
1736
 
1737
+ function getAdditionalParamsForCreate(oStartupParameters, oInboundParameters) {
1738
+ var oInbounds = oInboundParameters,
1739
+ aCreateParameters = oInbounds
1740
+ ? Object.keys(oInbounds).filter(function(sParameter) {
1741
+ return oInbounds[sParameter].useForCreate;
1742
+ })
1743
+ : [],
1744
+ oRet;
1745
+ for (var i = 0; i < aCreateParameters.length; i++) {
1746
+ var sCreateParameter = aCreateParameters[i];
1747
+ var aValues = oStartupParameters && oStartupParameters[sCreateParameter];
1748
+ if (aValues && aValues.length === 1) {
1749
+ oRet = oRet || Object.create(null);
1750
+ oRet[sCreateParameter] = aValues[0];
1751
+ }
1752
+ }
1753
+ return oRet;
1754
+ }
1706
1755
  /**
1707
1756
  * Gets semantic object mappings defined in app descriptor outbounds.
1708
1757
  *
@@ -2264,263 +2313,6 @@ sap.ui.define(
2264
2313
  });
2265
2314
  }
2266
2315
 
2267
- /**
2268
- * Check if given path resides in the context path provided.
2269
- *
2270
- * @function
2271
- * @name sap.fe.core.CommonUtils.isPathApplicableToContextPath
2272
- * @memberof sap.fe.core.CommonUtils
2273
- * @param {object} [oMetaModel] MetaModel to be used
2274
- * @param {string} [sContextPath] Context path to be used
2275
- * @param {string} [sPath] Path to be used
2276
- * @param {string} [sStrategy] Strategy, it could be 'self' | 'includingDependents'
2277
- * @returns {boolean} If path is applicable to context.
2278
- **/
2279
- function isPathApplicableToContextPath(oMetaModel, sContextPath, sPath, sStrategy) {
2280
- var sContextPathToCheck = sContextPath.startsWith("/") ? sContextPath : "/" + sContextPath,
2281
- sPathToCheck = sPath.startsWith("/") ? sPath : "/" + sPath,
2282
- fnIsApplicable = function(sPrimaryPath, sKey) {
2283
- return sPrimaryPath === sKey || (sStrategy === "includingDependents" && sPrimaryPath.startsWith(sKey));
2284
- },
2285
- fnSimplifyEntitySetPath = function(sEntitySetPathToUse) {
2286
- var sEntitySetPath = ModelHelper.getEntitySetPath(sEntitySetPathToUse);
2287
- var sEntitySet = sEntitySetPath.indexOf("$NavigationPropertyBinding") > -1 && oMetaModel.getObject(sEntitySetPath);
2288
- return sEntitySet ? "/" + sEntitySet : sEntitySetPathToUse;
2289
- };
2290
-
2291
- if (!fnIsApplicable(sContextPathToCheck, sPathToCheck)) {
2292
- sContextPathToCheck = fnSimplifyEntitySetPath(sContextPathToCheck);
2293
-
2294
- if (!fnIsApplicable(sContextPathToCheck, sPathToCheck)) {
2295
- sPathToCheck = fnSimplifyEntitySetPath(sPathToCheck);
2296
- } else {
2297
- return true;
2298
- }
2299
- }
2300
-
2301
- return fnIsApplicable(sContextPathToCheck, sPathToCheck);
2302
- }
2303
-
2304
- /**
2305
- * Get controls to refresh in a view.
2306
- *
2307
- * @function
2308
- * @name sap.fe.core.CommonUtils.getControlsForRefresh
2309
- * @memberof sap.fe.core.CommonUtils
2310
- * @param {object} [oView] View of the controls
2311
- * @param {Array} [aViewControls] Controls to be checked
2312
- * @returns {Array} Controls that need to be refreshed
2313
- **/
2314
- function getControlsForRefresh(oView, aViewControls) {
2315
- var aControls = [],
2316
- oMetaModel = oView.getModel().getMetaModel(),
2317
- oInternalModel = oView.getModel("internal"),
2318
- oRefreshStrategyForKeepAliveRestore = oInternalModel.getProperty("/refreshStrategyOnAppRestore") || {};
2319
-
2320
- if (aViewControls) {
2321
- aViewControls.forEach(function(oControl) {
2322
- var sContextPath = oControl.data("targetCollectionPath");
2323
-
2324
- for (var sKey in oRefreshStrategyForKeepAliveRestore) {
2325
- var sStrategy = oRefreshStrategyForKeepAliveRestore[sKey];
2326
- if (CommonUtils.isPathApplicableToContextPath(oMetaModel, sContextPath, sKey, sStrategy)) {
2327
- aControls.push(oControl);
2328
- }
2329
- }
2330
- });
2331
- }
2332
-
2333
- return aControls;
2334
- }
2335
-
2336
- /**
2337
- * Get refresh strategy for the control for a context path.
2338
- *
2339
- * @function
2340
- * @name sap.fe.core.CommonUtils.getControlRefreshStrategyForContextPath
2341
- * @memberof sap.fe.core.CommonUtils
2342
- * @param {object} [oControl] Control from which refresh info is needed
2343
- * @param {string} sContextPath ContextPath for properities
2344
- * @returns {string} Strategy for control refresh
2345
- **/
2346
-
2347
- function getControlRefreshStrategyForContextPath(oControl, sContextPath) {
2348
- var oMetaModel = oControl.getModel().getMetaModel(),
2349
- oInternalModel = oControl.getModel("internal"),
2350
- oRefreshStrategyForKeepAliveRestore = oInternalModel.getProperty("/refreshStrategyOnAppRestore"),
2351
- sStrategy;
2352
-
2353
- if (sContextPath) {
2354
- for (var sKey in oRefreshStrategyForKeepAliveRestore) {
2355
- var sStrategyToCheck = oRefreshStrategyForKeepAliveRestore[sKey];
2356
- if (CommonUtils.isPathApplicableToContextPath(oMetaModel, sContextPath, sKey, sStrategyToCheck)) {
2357
- sStrategy = sStrategyToCheck;
2358
- if (sStrategy === "includingDependents") {
2359
- break;
2360
- }
2361
- }
2362
- }
2363
- }
2364
-
2365
- return sStrategy;
2366
- }
2367
-
2368
- /**
2369
- * Get refresh info from view.
2370
- *
2371
- * @function
2372
- * @name sap.fe.core.CommonUtils.getViewRefreshInfo
2373
- * @memberof sap.fe.core.CommonUtils
2374
- * @param {object} [oView] View from which refresh info is needed
2375
- * @returns {string} Strategy for view refresh
2376
- **/
2377
- function getViewRefreshInfo(oView) {
2378
- var mViewData = oView.getViewData(),
2379
- sContextPath = mViewData && (mViewData.contextPath || "/" + mViewData.entitySet);
2380
-
2381
- return CommonUtils.getControlRefreshStrategyForContextPath(oView, sContextPath);
2382
- }
2383
-
2384
- /**
2385
- * Get MetaPath for the context.
2386
- *
2387
- * @function
2388
- * @name sap.fe.core.CommonUtils.getMetaPathForContext
2389
- * @memberof sap.fe.core.CommonUtils
2390
- * @param {object} [oContext] Outbound defined in app descriptor
2391
- * @returns {string} Meta path for the context
2392
- **/
2393
- function getMetaPathForContext(oContext) {
2394
- var oModel = oContext && oContext.getModel && oContext.getModel(),
2395
- oMetaModel = oModel && oModel.getMetaModel && oModel.getMetaModel(),
2396
- sPath = oContext && oContext.getPath && oContext.getPath();
2397
-
2398
- return oMetaModel && sPath && oMetaModel.getMetaPath && oMetaModel.getMetaPath(sPath);
2399
- }
2400
-
2401
- /**
2402
- * Get MetaPath for the listbinding.
2403
- *
2404
- * @function
2405
- * @name sap.fe.core.CommonUtils.getAbsoluteMetaPathForListBinding
2406
- * @memberof sap.fe.core.CommonUtils
2407
- * @param {object} [oView] The View
2408
- * @param {sap.ui.model.odata.v4.ODataListBinding|string} vListBinding ODataListBinding object or the binding path for a temporary list binding
2409
- * @returns {string} Meta path for the listbinding
2410
- **/
2411
- function getAbsoluteMetaPathForListBinding(oView, vListBinding) {
2412
- var oMetaModel = oView.getModel().getMetaModel(),
2413
- sMetaPath;
2414
- if (vListBinding && typeof vListBinding === "object") {
2415
- // we already get a list binding use this one
2416
- var oBinding = vListBinding;
2417
- var oRootBinding = oBinding.getRootBinding();
2418
- if (oBinding === oRootBinding) {
2419
- // absolute path
2420
- sMetaPath = oMetaModel.getMetaPath(oBinding.getPath());
2421
- } else {
2422
- // relative path
2423
- var sRootBindingPath = oRootBinding.getPath();
2424
- var sRelativePath = oBinding.getPath();
2425
- sMetaPath = oMetaModel.getMetaPath(sRootBindingPath + "/" + sRelativePath);
2426
- }
2427
- } else if (typeof vListBinding === "string") {
2428
- if (vListBinding.startsWith("/")) {
2429
- // absolute path
2430
- sMetaPath = oMetaModel.getMetaPath(vListBinding);
2431
- } else {
2432
- // relative path
2433
- var oBindingContext = oView.getBindingContext();
2434
- var sRootContextPath = oBindingContext.getPath();
2435
- sMetaPath = oMetaModel.getMetaPath(sRootContextPath + "/" + vListBinding);
2436
- }
2437
- }
2438
- return sMetaPath;
2439
- }
2440
-
2441
- /**
2442
- * Get refresh strategy for an intent.
2443
- *
2444
- * @function
2445
- * @name sap.fe.core.CommonUtils.getRefreshStrategyForIntent
2446
- * @memberof sap.fe.core.CommonUtils
2447
- * @param {object} mRefreshStrategies RefreshStrategies to consider
2448
- * @param {string} sSemanticObject Outbound Semantic Object
2449
- * @param {string} sAction Outbound Action
2450
- * @returns {object} Meta path for the context
2451
- **/
2452
- function getRefreshStrategyForIntent(mRefreshStrategies, sSemanticObject, sAction) {
2453
- return (
2454
- (mRefreshStrategies.intents &&
2455
- ((sSemanticObject && sAction && mRefreshStrategies.intents[sSemanticObject + "-" + sAction]) ||
2456
- (sSemanticObject && mRefreshStrategies.intents[sSemanticObject]))) ||
2457
- mRefreshStrategies["defaultBehavior"] ||
2458
- mRefreshStrategies["_feDefault"]
2459
- );
2460
- }
2461
-
2462
- /**
2463
- * Store control refresh strategy for hash in the internal model.
2464
- *
2465
- * @function
2466
- * @name sap.fe.core.CommonUtils.storeControlRefreshStrategyForHash
2467
- * @memberof sap.fe.core.CommonUtils
2468
- * @param {object} oControl Control for the refresh strategy
2469
- * @param {object} oHash Shell hash object
2470
- **/
2471
- function storeControlRefreshStrategyForHash(oControl, oHash) {
2472
- if (oControl && oControl.getModel("viewData") && oControl.getModel("internal")) {
2473
- var mViewData = oControl.getModel("viewData");
2474
- var oRefreshStrategies = mViewData.getObject("/refreshStrategyOnAppRestore");
2475
- if (oRefreshStrategies) {
2476
- var mInternalModel = oControl.getModel("internal");
2477
- var oRefreshStrategy = CommonUtils.getRefreshStrategyForIntent(
2478
- oRefreshStrategies,
2479
- oHash && oHash.semanticObject,
2480
- oHash && oHash.action
2481
- );
2482
-
2483
- mInternalModel.setProperty("/refreshStrategyOnAppRestore", oRefreshStrategy);
2484
- }
2485
- }
2486
- }
2487
- /**
2488
- * Method to refresh and restore the view if neccessary.
2489
- *
2490
- * @function
2491
- * @name sap.fe.core.CommonUtils.restoreView
2492
- * @memberof sap.fe.core.CommonUtils
2493
- * @param {object} oView Control for the refresh strategy
2494
- * @returns {Promise} A promise after view refresh and restore are triggered
2495
- **/
2496
- function restoreView(oView) {
2497
- var oInternalModelContext = oView.getBindingContext("internal");
2498
- var oController = oView.getController();
2499
- var oViewState = oController.viewState;
2500
- var pRefreshBindings = Promise.resolve();
2501
- if (oInternalModelContext.getProperty("restoreStatus") === "pending") {
2502
- if (oViewState.refreshViewBindings) {
2503
- pRefreshBindings = oViewState.refreshViewBindings();
2504
- pRefreshBindings
2505
- .then(function() {
2506
- Log.info("FE V4: Refresh was triggered successfull: " + oView.getId());
2507
- })
2508
- .catch(function(err) {
2509
- Log.warning("FE V4: Refresh was unsuccessfull: " + oView.getId(), err);
2510
- });
2511
- }
2512
- pRefreshBindings
2513
- .then(function() {
2514
- oViewState.onRestore();
2515
- oInternalModelContext.setProperty("restoreStatus", "done");
2516
- })
2517
- .catch(function(err) {
2518
- Log.warning("FE V4: Restore was unsuccessfull: " + oView.getId());
2519
- });
2520
- }
2521
- return pRefreshBindings;
2522
- }
2523
-
2524
2316
  var CommonUtils = {
2525
2317
  isPropertyFilterable: isPropertyFilterable,
2526
2318
  isFieldControlPathInapplicable: isFieldControlPathInapplicable,
@@ -2563,6 +2355,7 @@ sap.ui.define(
2563
2355
  getSearchRestrictions: getSearchRestrictions,
2564
2356
  getFilterRestrictionsByPath: getFilterRestrictionsByPath,
2565
2357
  getSpecificAllowedExpression: getSpecificAllowedExpression,
2358
+ getAdditionalParamsForCreate: getAdditionalParamsForCreate,
2566
2359
  requestSingletonProperty: requestSingletonProperty,
2567
2360
  templateControlFragment: templateControlFragment,
2568
2361
  addEventToBindingInfo: addEventToBindingInfo,
@@ -2580,15 +2373,7 @@ sap.ui.define(
2580
2373
  "MultiRangeOrSearchExpression"
2581
2374
  ],
2582
2375
  fnProcessDataLossOrDraftDiscardConfirmation: fnProcessDataLossOrDraftDiscardConfirmation,
2583
- isPathApplicableToContextPath: isPathApplicableToContextPath,
2584
- getControlsForRefresh: getControlsForRefresh,
2585
- getViewRefreshInfo: getViewRefreshInfo,
2586
- getMetaPathForContext: getMetaPathForContext,
2587
- getAbsoluteMetaPathForListBinding: getAbsoluteMetaPathForListBinding,
2588
- getControlRefreshStrategyForContextPath: getControlRefreshStrategyForContextPath,
2589
- getRefreshStrategyForIntent: getRefreshStrategyForIntent,
2590
- storeControlRefreshStrategyForHash: storeControlRefreshStrategyForHash,
2591
- restoreView: restoreView
2376
+ normalizeSearchTerm: normalizeSearchTerm
2592
2377
  };
2593
2378
 
2594
2379
  return CommonUtils;
@@ -128,6 +128,7 @@ sap.ui.define(
128
128
  this._bDisableOnHashChange = false;
129
129
  this._bIgnoreRestore = false;
130
130
  this._bCleanedRestore = false;
131
+ this._bForceFocus = true; // Trigger the focus mechanism for the first view displayed by the app
131
132
  },
132
133
 
133
134
  destroy: function() {
@@ -158,6 +159,14 @@ sap.ui.define(
158
159
  return this._oRouter.getHashChanger().getHash();
159
160
  },
160
161
 
162
+ isFocusForced: function() {
163
+ return this._bForceFocus;
164
+ },
165
+
166
+ setFocusForced: function(bForced) {
167
+ this._bForceFocus = bForced;
168
+ },
169
+
161
170
  /**
162
171
  * Resets the internal variable sIAppStateKey.
163
172
  *
@@ -180,42 +189,31 @@ sap.ui.define(
180
189
  * @param {string} sHash Hash to be navigated to
181
190
  * @param {boolean} bPreserveHistory If set to true, non-ancestor entries in history will be retained
182
191
  * @param {boolean} bDisablePreservationCache If set to true, cache preservation mechanism is disabled for the current navigation
192
+ * @param {boolean} bForceFocus If set to true, the logic to set the focus once the navigation is finalized will be triggered (onPageReady)
183
193
  * @returns {Promise} Promise that is resolved when the navigation is finalized
184
194
  * @ui5-restricted
185
195
  */
186
- navToHash: function(sHash, bPreserveHistory, bDisablePreservationCache) {
196
+ navToHash: function(sHash, bPreserveHistory, bDisablePreservationCache, bForceFocus) {
187
197
  var that = this;
188
198
 
189
199
  if (this._oRouteMatchSynchronization) {
190
200
  return this._oRouteMatchSynchronization.waitFor().then(function() {
191
201
  that._oRouteMatchSynchronization = null;
192
- return that._internalNavToHash(sHash, bPreserveHistory, bDisablePreservationCache);
202
+ return that._internalNavToHash(sHash, bPreserveHistory, bDisablePreservationCache, bForceFocus);
193
203
  });
194
204
  } else {
195
205
  if (this._bActivateRouteMatchSynchro) {
196
206
  this.waitForRouteMatchBeforeNavigation();
197
207
  }
198
- return that._internalNavToHash(sHash, bPreserveHistory, bDisablePreservationCache);
208
+ return that._internalNavToHash(sHash, bPreserveHistory, bDisablePreservationCache, bForceFocus);
199
209
  }
200
210
  },
201
211
 
202
- _internalNavToHash: function(sHash, bPreserveHistory, bDisablePreservationCache) {
203
- var that = this,
204
- sLastFocusControlId = sap.ui.getCore().getCurrentFocusedControlId(),
205
- sLastFocusInfo =
206
- sLastFocusControlId && sap.ui.getCore().byId(sLastFocusControlId)
207
- ? sap.ui
208
- .getCore()
209
- .byId(sLastFocusControlId)
210
- .getFocusInfo()
211
- : null,
212
- shashBeforeRoutechanged = this.getHash();
213
-
212
+ _internalNavToHash: function(sHash, bPreserveHistory, bDisablePreservationCache, bForceFocus) {
214
213
  // Add the app state in the hash if needed
215
214
  if (this.fclEnabled && this.sIAppStateKey && !findAppStateInHash(sHash)) {
216
215
  sHash = setAppStateInHash(sHash, this.sIAppStateKey);
217
216
  }
218
- var oNewState = this._extractStateFromHash(sHash);
219
217
 
220
218
  if (!this.checkHashWithGuard(sHash)) {
221
219
  if (!this.oResourceBundle) {
@@ -230,11 +228,24 @@ sap.ui.define(
230
228
  }
231
229
  this.bIsGuardCrossAllowed = true;
232
230
  }
231
+
232
+ // In case the navigation will cause a new view to be displayed, we force the focus
233
+ // I.e. if the keys for the hash we're navigating to is a superset of the current hash keys.
234
+ var oNewState = this._extractStateFromHash(sHash);
235
+ if (!this._bForceFocus) {
236
+ // If the focus was already forced, keep it
237
+ var aCurrentHashKeys = this._extractKeysFromHash(this.getHash());
238
+ this._bForceFocus =
239
+ bForceFocus ||
240
+ (aCurrentHashKeys.length < oNewState.keys.length &&
241
+ aCurrentHashKeys.every(function(key, index) {
242
+ return key === oNewState.keys[index];
243
+ }));
244
+ }
245
+
233
246
  var oHistoryAction = this._pushNewState(oNewState, false, bPreserveHistory, bDisablePreservationCache);
234
247
 
235
- return this._rebuildBrowserHistory(oHistoryAction, false).then(function() {
236
- that.storeFocusForHash(sLastFocusControlId, sLastFocusInfo, shashBeforeRoutechanged);
237
- });
248
+ return this._rebuildBrowserHistory(oHistoryAction, false);
238
249
  },
239
250
 
240
251
  /**
@@ -258,34 +269,6 @@ sap.ui.define(
258
269
  }
259
270
  },
260
271
 
261
- getFocusControlForCurrentHash: function() {
262
- var sCurrenthash = this.getHash();
263
- var oLastFocusedControl;
264
- for (var i = this._oManagedHistory.length - 1; i >= 0; i--) {
265
- if (sCurrenthash === this._oManagedHistory[i].hash) {
266
- oLastFocusedControl = this._oManagedHistory[i].oLastFocusControl;
267
- break;
268
- } else {
269
- this._oManagedHistory[i].oLastFocusControl = undefined;
270
- }
271
- }
272
-
273
- return oLastFocusedControl;
274
- },
275
-
276
- storeFocusForHash: function(sLastFocusControlId, sLastFocusInfo, sHash) {
277
- var oManagedhistory = this._oManagedHistory;
278
- for (var i = 0; i < oManagedhistory.length; i++) {
279
- if (sHash === oManagedhistory[i].hash) {
280
- oManagedhistory[i].oLastFocusControl = {
281
- controlId: sLastFocusControlId,
282
- focusInfo: sLastFocusInfo
283
- };
284
- break;
285
- }
286
- }
287
- },
288
-
289
272
  /**
290
273
  * Navigates back in the history.
291
274
  *
@@ -432,6 +415,24 @@ sap.ui.define(
432
415
  this._bActivateRouteMatchSynchro = false;
433
416
  },
434
417
 
418
+ _extractKeysFromHash: function(sHash) {
419
+ if (sHash === undefined) {
420
+ sHash = "";
421
+ }
422
+ var sHashNoParams = sHash.split("?")[0]; // remove params
423
+ var aTokens = sHashNoParams.split("/");
424
+ var aKeys = [];
425
+
426
+ aTokens.forEach(function(sToken) {
427
+ var regexKey = /[^\(\)]+\([^\(\)]+\)/; // abc(def)
428
+ if (regexKey.test(sToken)) {
429
+ aKeys.push(sToken.split("(")[0]);
430
+ }
431
+ });
432
+
433
+ return aKeys;
434
+ },
435
+
435
436
  /**
436
437
  * Builds a state from a hash.
437
438
  *
@@ -441,22 +442,13 @@ sap.ui.define(
441
442
  * @ui5-restricted
442
443
  */
443
444
  _extractStateFromHash: function(sHash) {
444
- var oState = {
445
- keys: []
446
- };
447
-
448
- // Retrieve object keys
449
445
  if (sHash === undefined) {
450
446
  sHash = "";
451
447
  }
452
- var sHashNoParams = sHash.split("?")[0];
453
- var sTokens = sHashNoParams.split("/");
454
- sTokens.forEach(function(sToken) {
455
- var regexKey = /[^\(\)]+\([^\(\)]+\)/; // abc(def)
456
- if (regexKey.test(sToken)) {
457
- oState.keys.push(sToken.split("(")[0]);
458
- }
459
- });
448
+
449
+ var oState = {
450
+ keys: this._extractKeysFromHash(sHash)
451
+ };
460
452
 
461
453
  // Retrieve layout (if any)
462
454
  var aLayout = sHash.match(new RegExp("\\?.*" + enumURLParams.LAYOUTPARAM + "=([^&]*)"));
@@ -518,7 +510,6 @@ sap.ui.define(
518
510
  }
519
511
 
520
512
  // 3. Then pop all states until we find an ancestor of the new state, or we find a state that need to be preserved
521
- var oLastFocusControl;
522
513
  var oLastRemovedItem;
523
514
  while (this._oManagedHistory.length > 0) {
524
515
  var oTopState = this._oManagedHistory[this._oManagedHistory.length - 1];
@@ -527,13 +518,11 @@ sap.ui.define(
527
518
  this._compareCacheStates(oTopState, oNewState) !== enumState.ANCESTOR
528
519
  ) {
529
520
  // The top state is not an ancestor of oNewState and is not preserved --> we can pop it
530
- oLastFocusControl = oTopState.oLastFocusControl;
531
521
  oLastRemovedItem = this._oManagedHistory.pop();
532
522
  iPopCount++;
533
523
  } else if (oTopState.preserved && removeAppStateInHash(oTopState.hash) === removeAppStateInHash(oNewState.hash)) {
534
524
  // We try to add a state that is already in cache (due to preserved flag) but with a different iapp-state
535
525
  // --> we should delete the previous entry (it will be later replaced by the new one) and stop popping
536
- oLastFocusControl = oTopState.oLastFocusControl;
537
526
  oLastRemovedItem = this._oManagedHistory.pop();
538
527
  iPopCount++;
539
528
  oNewState.preserved = true;
@@ -565,7 +554,6 @@ sap.ui.define(
565
554
  }
566
555
 
567
556
  // 5. Now we can push the state at the top of the internal history
568
- oNewState.oLastFocusControl = oLastFocusControl;
569
557
  var bHasSameHash = oLastRemovedItem && oNewState.hash === oLastRemovedItem.hash;
570
558
  if (this._oManagedHistory.length === 0 || this._oManagedHistory[this._oManagedHistory.length - 1].hash !== oNewState.hash) {
571
559
  this._oManagedHistory.push(oNewState);
@@ -102,11 +102,11 @@ sap.ui.define(
102
102
  return this.oAppComponent;
103
103
  },
104
104
 
105
- onPageReady: function(oLastFocusedControl) {
105
+ onPageReady: function(mParameters) {
106
106
  if (this.getRootControl() && this.getRootControl().getController() && this.getRootControl().getController().onPageReady) {
107
107
  this.getRootControl()
108
108
  .getController()
109
- .onPageReady(oLastFocusedControl);
109
+ .onPageReady(mParameters);
110
110
  }
111
111
  },
112
112