@sapui5/sap.fe.navigation 1.104.1 → 1.105.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapui5/sap.fe.navigation",
3
- "version": "1.104.1",
3
+ "version": "1.105.0",
4
4
  "description": "SAPUI5 Library sap.fe.navigation",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "SAP SE (https://www.sap.com)",
@@ -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.104.1</version>
9
+ <version>1.105.0</version>
10
10
 
11
11
  <documentation>UI5 library: sap.fe.navigation</documentation>
12
12
 
@@ -84,6 +84,7 @@ sap.ui.define(
84
84
  "navigate",
85
85
  "parseNavigation",
86
86
  "storeInnerAppState",
87
+ "storeInnerAppStateAsync",
87
88
  "storeInnerAppStateWithImmediateReturn",
88
89
  "processBeforeSmartLinkPopoverOpens",
89
90
  "processBeforeSemanticLinkPopoverOpens",
@@ -435,7 +436,7 @@ sap.ui.define(
435
436
  };
436
437
  var fnStoreAndNavigate = function (oCrossAppNavService) {
437
438
  oNavHandler
438
- .storeInnerAppState(oInnerAppData, true)
439
+ .storeInnerAppStateAsync(oInnerAppData, true)
439
440
  .then(function (sAppStateKey) {
440
441
  if (sAppStateKey) {
441
442
  oNavHandler.replaceHash(sAppStateKey);
@@ -511,7 +512,7 @@ sap.ui.define(
511
512
  * <li><code>oAppData.tableVariantId</code></li>
512
513
  * <li><code>oAppData.customData</code></li>
513
514
  * </ul>
514
- * which return the inner app data as stored in {@link #.navigate navigate} or {@link #.storeInnerAppState storeInnerAppState}.
515
+ * which return the inner app data as stored in {@link #.navigate navigate} or {@link #.storeInnerAppStateAsync storeInnerAppStateAsync}.
515
516
  * <code>oAppData.oDefaultedSelectionVariant</code> is an empty selection variant and
516
517
  * <code>oAppData.bNavSelVarHasDefaultsOnly</code> is <code>false</code> in this case.<br>
517
518
  * <b>Note:</b> If the navigation type is {@link sap.fe.navigation.NavType.initial} oAppData is an empty object!<br>
@@ -940,7 +941,7 @@ sap.ui.define(
940
941
  * @param {object} [mInnerAppData.semanticDates] Object containing semanticDates filter information
941
942
  * @param {boolean} [bImmediateHashReplace=true] If set to false, the inner app hash will not be replaced until storing is successful; do not
942
943
  * set to false if you cannot react to the resolution of the Promise, for example, when calling the beforeLinkPressed event
943
- * @param {boolean} [bSkipHashReplace=false] If set to true, the inner app hash will not be replaced in the storeInnerAppState. Also the bImmediateHashReplace
944
+ * @param {boolean} [bSkipHashReplace=false] If set to true, the inner app hash will not be replaced in the storeInnerAppStateAsync. Also the bImmediateHashReplace
944
945
  * will be ignored.
945
946
  * @returns {object} A Promise object to monitor when all the actions of the function have been executed; if the execution is successful, the
946
947
  * app state key is returned; if an error occurs, an object of type {@link sap.fe.navigation.NavError} is
@@ -955,7 +956,7 @@ sap.ui.define(
955
956
  * customData : oMyCustomData
956
957
  * };
957
958
  *
958
- * var oStoreInnerAppStatePromise = oNavigationHandler.storeInnerAppState(mInnerAppData);
959
+ * var oStoreInnerAppStatePromise = oNavigationHandler.storeInnerAppStateAsync(mInnerAppData);
959
960
  *
960
961
  * oStoreInnerAppStatePromise.done(function(sAppStateKey){
961
962
  * //your inner app state is saved now, sAppStateKey was added to URL
@@ -968,7 +969,7 @@ sap.ui.define(
968
969
  * });
969
970
  * </code>
970
971
  */
971
- storeInnerAppState: function (mInnerAppData, bImmediateHashReplace, bSkipHashReplace) {
972
+ storeInnerAppStateAsync: function (mInnerAppData, bImmediateHashReplace, bSkipHashReplace) {
972
973
  if (typeof bImmediateHashReplace !== "boolean") {
973
974
  bImmediateHashReplace = true; // default
974
975
  }
@@ -1047,6 +1048,127 @@ sap.ui.define(
1047
1048
  return oMyDeferred.promise();
1048
1049
  },
1049
1050
 
1051
+ /**
1052
+ * Changes the URL according to the current app state and stores the app state for later retrieval.
1053
+ *
1054
+ * @param {object} mInnerAppData Object containing the current state of the app
1055
+ * @param {string} mInnerAppData.selectionVariant Stringified JSON object as returned, for example, from getDataSuiteFormat() of the
1056
+ * SmartFilterBar control
1057
+ * @param {string} [mInnerAppData.tableVariantId] ID of the SmartTable variant
1058
+ * @param {object} [mInnerAppData.customData] Object that can be used to store additional app-specific data
1059
+ * @param {object} [mInnerAppData.presentationVariant] Object containing the current ui state of the app
1060
+ * @param {object} [mInnerAppData.valueTexts] Object containing value descriptions
1061
+ * @param {object} [mInnerAppData.semanticDates] Object containing semanticDates filter information
1062
+ * @param {boolean} [bImmediateHashReplace=true] If set to false, the inner app hash will not be replaced until storing is successful; do not
1063
+ * set to false if you cannot react to the resolution of the Promise, for example, when calling the beforeLinkPressed event
1064
+ * @returns {object} A Promise object to monitor when all the actions of the function have been executed; if the execution is successful, the
1065
+ * app state key is returned; if an error occurs, an object of type {@link sap.fe.navigation.NavError} is
1066
+ * returned
1067
+ * @public
1068
+ * @example <code>
1069
+ * sap.ui.define(["sap/fe/navigation/NavigationHandler"], function (NavigationHandler) {
1070
+ * var oNavigationHandler = new NavigationHandler(oController);
1071
+ * var mInnerAppData = {
1072
+ * selectionVariant : oSmartFilterBar.getDataSuiteFormat(),
1073
+ * tableVariantId : oSmartTable.getCurrentVariantId(),
1074
+ * customData : oMyCustomData
1075
+ * };
1076
+ *
1077
+ * var oStoreInnerAppStatePromise = oNavigationHandler.storeInnerAppState(mInnerAppData);
1078
+ *
1079
+ * oStoreInnerAppStatePromise.done(function(sAppStateKey){
1080
+ * //your inner app state is saved now, sAppStateKey was added to URL
1081
+ * //perform actions that must run after save
1082
+ * });
1083
+ *
1084
+ * oStoreInnerAppStatePromise.fail(function(oError){
1085
+ * //some error handling
1086
+ * });
1087
+ * });
1088
+ * </code>
1089
+ * @deprecated as of version 1.104. Use the {@link sap.fe.navigation.NavigationHandler.storeInnerAppStateAsync} instead.
1090
+ */
1091
+
1092
+ storeInnerAppState: function (mInnerAppData, bImmediateHashReplace) {
1093
+ Log.error(
1094
+ "Deprecated API call of 'sap.fe.navigation.NavigationHandler.storeInnerAppState'. Please use 'storeInnerAppStateAsync' instead",
1095
+ null,
1096
+ "sap.fe.navigation.NavigationHandler"
1097
+ );
1098
+ if (typeof bImmediateHashReplace !== "boolean") {
1099
+ bImmediateHashReplace = true; // default
1100
+ }
1101
+ var oNavHandler = this;
1102
+ var oMyDeferred = jQuery.Deferred();
1103
+
1104
+ var fnReplaceHash = function (sAppStateKey) {
1105
+ var oHashChanger = oNavHandler.oRouter.oHashChanger ? oNavHandler.oRouter.oHashChanger : HashChanger.getInstance();
1106
+ var sAppHashOld = oHashChanger.getHash();
1107
+ /*
1108
+ * use .getHash() here instead of .getAppHash() to also be able dealing with environments where only SAPUI5 is loaded and the UShell
1109
+ * is not initialized properly.
1110
+ */
1111
+ var sAppHashNew = oNavHandler._replaceInnerAppStateKey(sAppHashOld, sAppStateKey);
1112
+ oHashChanger.replaceHash(sAppHashNew);
1113
+ };
1114
+
1115
+ // in case mInnerAppState is empty, do not overwrite the last saved state
1116
+ if (isEmptyObject(mInnerAppData)) {
1117
+ oMyDeferred.resolve("");
1118
+ return oMyDeferred.promise();
1119
+ }
1120
+
1121
+ // check if we already saved the same data
1122
+ var sAppStateKeyCached = this._oLastSavedInnerAppData.sAppStateKey;
1123
+
1124
+ var bInnerAppDataEqual = JSON.stringify(mInnerAppData) === JSON.stringify(this._oLastSavedInnerAppData.oAppData);
1125
+ if (bInnerAppDataEqual && sAppStateKeyCached) {
1126
+ // passed inner app state found in cache
1127
+ this._oLastSavedInnerAppData.iCacheHit++;
1128
+
1129
+ // replace inner app hash with cached appStateKey in url (just in case the app has changed the hash in meantime)
1130
+ fnReplaceHash(sAppStateKeyCached);
1131
+ oMyDeferred.resolve(sAppStateKeyCached);
1132
+ return oMyDeferred.promise();
1133
+ }
1134
+
1135
+ // passed inner app state not found in cache
1136
+ this._oLastSavedInnerAppData.iCacheMiss++;
1137
+
1138
+ var fnOnAfterSave = function (sAppStateKey) {
1139
+ // replace inner app hash with new appStateKey in url
1140
+ if (!bImmediateHashReplace) {
1141
+ fnReplaceHash(sAppStateKey);
1142
+ }
1143
+
1144
+ // remember last saved state
1145
+ oNavHandler._oLastSavedInnerAppData.oAppData = mInnerAppData;
1146
+ oNavHandler._oLastSavedInnerAppData.sAppStateKey = sAppStateKey;
1147
+ oMyDeferred.resolve(sAppStateKey);
1148
+ };
1149
+
1150
+ var fnOnError = function (oError) {
1151
+ oMyDeferred.reject(oError);
1152
+ };
1153
+
1154
+ var sAppStateKey = this._saveAppState(mInnerAppData, fnOnAfterSave, fnOnError);
1155
+ /*
1156
+ * Note that _sapAppState may return 'undefined' in case that the parsing has failed. In this case, we should not trigger the replacement
1157
+ * of the App Hash with the generated key, as the container was not written before. Note as well that the error handling has already
1158
+ * happened before by making the oMyDeferred promise fail (see fnOnError above).
1159
+ */
1160
+ if (sAppStateKey !== undefined) {
1161
+ // replace inner app hash with new appStateKey in url
1162
+ // note: we do not wait for the save to be completed: this asynchronously behaviour is necessary if
1163
+ // this method is called e.g. in a onLinkPressed event with no possibility to wait for the promise resolution
1164
+ if (bImmediateHashReplace) {
1165
+ fnReplaceHash(sAppStateKey);
1166
+ }
1167
+ }
1168
+
1169
+ return oMyDeferred.promise();
1170
+ },
1171
+
1050
1172
  /**
1051
1173
  * Changes the URL according to the current app state and stores the app state for later retrieval.
1052
1174
  *
@@ -1091,11 +1213,11 @@ sap.ui.define(
1091
1213
  * });
1092
1214
  * </code>
1093
1215
  * @public
1094
- * @deprecated as of version 1.104. Use the {@link sap.fe.navigation.NavigationHandler.storeInnerAppState} instead.
1216
+ * @deprecated as of version 1.104. Use the {@link sap.fe.navigation.NavigationHandler.storeInnerAppStateAsync} instead.
1095
1217
  */
1096
1218
  storeInnerAppStateWithImmediateReturn: function (mInnerAppData, bImmediateHashReplace) {
1097
1219
  Log.error(
1098
- "Deprecated API call of 'sap.fe.navigation.NavigationHandler.storeInnerAppStateWithImmediateReturn'. Please use 'storeInnerAppState' instead",
1220
+ "Deprecated API call of 'sap.fe.navigation.NavigationHandler.storeInnerAppStateWithImmediateReturn'. Please use 'storeInnerAppStateAsync' instead",
1099
1221
  null,
1100
1222
  "sap.fe.navigation.NavigationHandler"
1101
1223
  );
@@ -1309,7 +1431,7 @@ sap.ui.define(
1309
1431
  };
1310
1432
 
1311
1433
  if (mInnerAppData) {
1312
- var oStoreInnerAppStatePromise = this.storeInnerAppState(mInnerAppData, true);
1434
+ var oStoreInnerAppStatePromise = this.storeInnerAppStateAsync(mInnerAppData, true);
1313
1435
 
1314
1436
  // if the inner app state was successfully stored, store also the xapp-state
1315
1437
  oStoreInnerAppStatePromise.done(function () {
@@ -1630,18 +1752,18 @@ sap.ui.define(
1630
1752
  },
1631
1753
  _fnSaveAppStateAsync: function (oAppData, fnOnError) {
1632
1754
  var oNavHandler = this;
1633
- return this._getAppNavigationServiceAsync().then(function (oCrossAppNavService) {
1634
- return oCrossAppNavService
1635
- .createEmptyAppStateAsync(oNavHandler.oComponent)
1636
- .then(function (oAppState) {
1637
- return oNavHandler._fnSaveAppStateWithImmediateReturn(oAppData, oAppState, fnOnError);
1638
- })
1639
- .catch(function (oError) {
1640
- if (fnOnError) {
1641
- fnOnError(oError);
1642
- }
1643
- });
1644
- });
1755
+ return this._getAppNavigationServiceAsync()
1756
+ .then(function (oCrossAppNavService) {
1757
+ return oCrossAppNavService.createEmptyAppStateAsync(oNavHandler.oComponent);
1758
+ })
1759
+ .then(function (oAppState) {
1760
+ return oNavHandler._fnSaveAppStateWithImmediateReturn(oAppData, oAppState, fnOnError);
1761
+ })
1762
+ .catch(function (oError) {
1763
+ if (fnOnError) {
1764
+ fnOnError(oError);
1765
+ }
1766
+ });
1645
1767
  },
1646
1768
  _saveAppStateWithImmediateReturn: function (oAppData, fnOnError) {
1647
1769
  var oAppState = this._getAppNavigationService().createEmptyAppState(this.oComponent);
@@ -26,7 +26,7 @@ sap.ui.define(
26
26
  var thisLib = sap.ui.getCore().initLibrary({
27
27
  name: "sap.fe.navigation",
28
28
  // eslint-disable-next-line no-template-curly-in-string
29
- version: "1.104.1",
29
+ version: "1.105.0",
30
30
  dependencies: ["sap.ui.core"],
31
31
  types: ["sap.fe.navigation.NavType", "sap.fe.navigation.ParamHandlingMode", "sap.fe.navigation.SuppressionBehavior"],
32
32
  interfaces: [],