@sapui5/sap.fe.navigation 1.103.0 → 1.104.1
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,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sapui5/sap.fe.navigation",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.104.1",
|
|
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)",
|
|
7
7
|
"homepage": "https://sap.github.io/ui5-tooling/pages/SAPUI5/",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "echo 'nothing to do'",
|
|
10
|
-
"prepare-npm-sources": "
|
|
10
|
+
"prepare-npm-sources": "echo 'nothing to do'",
|
|
11
11
|
"prepare-ts-class-doc": "echo 'nothing to do'",
|
|
12
12
|
"prepare-ui5-build-sources": "echo 'nothing to do'",
|
|
13
13
|
"test": "echo 'nothing to do'"
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
],
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@babel/cli": "^7.14.8",
|
|
21
|
-
"@ui5/cli": "^2.14.0"
|
|
22
|
-
"mkdirp": "^1.0.4"
|
|
21
|
+
"@ui5/cli": "^2.14.0"
|
|
23
22
|
}
|
|
24
23
|
}
|
|
@@ -76,9 +76,9 @@ sap.ui.define(
|
|
|
76
76
|
* <td>Indicates that the input parameter is invalid</td>
|
|
77
77
|
* </tr>
|
|
78
78
|
* </table>
|
|
79
|
-
* @
|
|
79
|
+
* @name sap.fe.navigation.NavigationHandler
|
|
80
80
|
*/
|
|
81
|
-
return BaseObject.extend("sap.fe.navigation.NavigationHandler" /** @lends sap.fe.navigation.NavigationHandler */, {
|
|
81
|
+
return BaseObject.extend("sap.fe.navigation.NavigationHandler" /** @lends sap.fe.navigation.NavigationHandler.prototype */, {
|
|
82
82
|
metadata: {
|
|
83
83
|
publicMethods: [
|
|
84
84
|
"navigate",
|
|
@@ -126,17 +126,6 @@ sap.ui.define(
|
|
|
126
126
|
throw new NavError("NavigationHandler.INVALID_INPUT");
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
try {
|
|
130
|
-
this.oCrossAppNavService = this._getAppNavigationService();
|
|
131
|
-
if (!this.oCrossAppNavService) {
|
|
132
|
-
Log.error("NavigationHandler: CrossApplicationNavigation is not available.");
|
|
133
|
-
throw new NavError("NavigationHandler.NO.XAPPSERVICE");
|
|
134
|
-
}
|
|
135
|
-
} catch (ex) {
|
|
136
|
-
Log.error("NavigationHandler: UShell service API for CrossApplicationNavigation is not available.");
|
|
137
|
-
// throw new NavError("NavigationHandler.NO.SHELL");
|
|
138
|
-
}
|
|
139
|
-
|
|
140
129
|
this.IAPP_STATE = "sap-iapp-state";
|
|
141
130
|
this.sDefaultedParamProp = "sap-ushell-defaultedParameterNames";
|
|
142
131
|
this.sSAPSystemProp = "sap-system";
|
|
@@ -196,6 +185,23 @@ sap.ui.define(
|
|
|
196
185
|
return sap.ushell.Container.getService("CrossApplicationNavigation");
|
|
197
186
|
},
|
|
198
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Retrieves the shell navigation service.
|
|
190
|
+
*
|
|
191
|
+
* @returns {object} The Navigation service
|
|
192
|
+
* @private
|
|
193
|
+
*/
|
|
194
|
+
_getAppNavigationServiceAsync: function () {
|
|
195
|
+
return sap.ushell.Container.getServiceAsync("CrossApplicationNavigation")
|
|
196
|
+
.then(function (oCrossAppNavService) {
|
|
197
|
+
return oCrossAppNavService;
|
|
198
|
+
})
|
|
199
|
+
.catch(function () {
|
|
200
|
+
Log.error("NavigationHandler: CrossApplicationNavigation is not available.");
|
|
201
|
+
throw new NavError("NavigationHandler.NO.XAPPSERVICE");
|
|
202
|
+
});
|
|
203
|
+
},
|
|
204
|
+
|
|
199
205
|
/**
|
|
200
206
|
* Retrieves the reference to the router object for navigation for this given Controller.
|
|
201
207
|
*
|
|
@@ -387,31 +393,26 @@ sap.ui.define(
|
|
|
387
393
|
params: mParameters || {}
|
|
388
394
|
};
|
|
389
395
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
var oSupportedPromise = oNavHandler.oCrossAppNavService.isNavigationSupported([oNavArguments], oNavHandler.oComponent);
|
|
395
|
-
oSupportedPromise.done(function (oTargets) {
|
|
396
|
-
if (oTargets[0].supported) {
|
|
397
|
-
var oReturn;
|
|
398
|
-
|
|
399
|
-
if (!bExPlace) {
|
|
400
|
-
oReturn = oNavHandler.storeInnerAppStateWithImmediateReturn(oInnerAppData, true);
|
|
401
|
-
if (oReturn && oReturn.appStateKey) {
|
|
402
|
-
oNavHandler.replaceHash(oReturn.appStateKey);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
if (!oXAppDataObj.selectionVariant) {
|
|
407
|
-
oXAppDataObj.selectionVariant = sSelectionVariant;
|
|
408
|
-
}
|
|
396
|
+
var fnNavigate = function (oCrossAppNavService) {
|
|
397
|
+
if (!oXAppDataObj.selectionVariant) {
|
|
398
|
+
oXAppDataObj.selectionVariant = sSelectionVariant;
|
|
399
|
+
}
|
|
409
400
|
|
|
410
|
-
|
|
401
|
+
var fnNavExplace = function () {
|
|
402
|
+
var sNewHrefPromise = oCrossAppNavService.hrefForExternalAsync(oNavArguments, oNavHandler.oComponent);
|
|
403
|
+
sNewHrefPromise
|
|
404
|
+
.then(function (sNewHref) {
|
|
405
|
+
openWindow(sNewHref);
|
|
406
|
+
})
|
|
407
|
+
.catch(function (oError) {
|
|
408
|
+
Log.error("Error while retireving hrefForExternal : " + oError);
|
|
409
|
+
});
|
|
410
|
+
};
|
|
411
411
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
412
|
+
oXAppDataObj = oNavHandler._removeMeasureBasedInformation(oXAppDataObj);
|
|
413
|
+
return oNavHandler._fnSaveAppStateAsync(oXAppDataObj, fnOnError).then(function (oSaveAppStateReturn) {
|
|
414
|
+
if (oSaveAppStateReturn) {
|
|
415
|
+
oNavArguments.appStateKey = oSaveAppStateReturn.appStateKey;
|
|
415
416
|
|
|
416
417
|
// Remark:
|
|
417
418
|
// The Cross App Service takes care of encoding parameter keys and values. Example:
|
|
@@ -421,39 +422,64 @@ sap.ui.define(
|
|
|
421
422
|
// toExternal sets sap-xapp-state in the URL if appStateKey is provided in oNavArguments
|
|
422
423
|
// toExternal has issues on sticky apps FIORITECHP1-14400, temp fix using hrefForExternal
|
|
423
424
|
if (sNavMode == "explace") {
|
|
424
|
-
|
|
425
|
-
oNavArguments,
|
|
426
|
-
oNavHandler.oComponent
|
|
427
|
-
);
|
|
428
|
-
sNewHrefPromise
|
|
429
|
-
.then(function (sNewHref) {
|
|
430
|
-
openWindow(sNewHref);
|
|
431
|
-
})
|
|
432
|
-
.catch(function (oError) {
|
|
433
|
-
Log.error("Error while retireving hrefForExternal : " + oError);
|
|
434
|
-
});
|
|
425
|
+
fnNavExplace();
|
|
435
426
|
} else {
|
|
436
|
-
var ptoExt =
|
|
427
|
+
var ptoExt = oCrossAppNavService.toExternal(oNavArguments, oNavHandler.oComponent);
|
|
437
428
|
// TODO: This is just a temporary solution to allow FE V2 to use toExternal promise.
|
|
438
429
|
if (oNavHandler._navigateCallback) {
|
|
439
430
|
oNavHandler._navigateCallback(ptoExt);
|
|
440
431
|
}
|
|
441
432
|
}
|
|
442
433
|
} // else : error was already reported
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
434
|
+
});
|
|
435
|
+
};
|
|
436
|
+
var fnStoreAndNavigate = function (oCrossAppNavService) {
|
|
437
|
+
oNavHandler
|
|
438
|
+
.storeInnerAppState(oInnerAppData, true)
|
|
439
|
+
.then(function (sAppStateKey) {
|
|
440
|
+
if (sAppStateKey) {
|
|
441
|
+
oNavHandler.replaceHash(sAppStateKey);
|
|
442
|
+
}
|
|
443
|
+
return fnNavigate(oCrossAppNavService);
|
|
444
|
+
})
|
|
445
|
+
.catch(function (oError) {
|
|
446
|
+
if (fnOnError) {
|
|
447
|
+
fnOnError(oError);
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
};
|
|
451
|
+
if (sNavMode) {
|
|
452
|
+
oNavArguments.params["sap-ushell-navmode"] = bExPlace ? "explace" : "inplace";
|
|
453
|
+
}
|
|
454
|
+
oNavHandler
|
|
455
|
+
._getAppNavigationServiceAsync()
|
|
456
|
+
.then(function (oCrossAppNavService) {
|
|
457
|
+
var oSupportedPromise = oCrossAppNavService.isNavigationSupported([oNavArguments], oNavHandler.oComponent);
|
|
458
|
+
oSupportedPromise.done(function (oTargets) {
|
|
459
|
+
if (oTargets[0].supported) {
|
|
460
|
+
if (!bExPlace) {
|
|
461
|
+
fnStoreAndNavigate(oCrossAppNavService);
|
|
462
|
+
} else {
|
|
463
|
+
fnNavigate(oCrossAppNavService);
|
|
464
|
+
}
|
|
465
|
+
} else if (fnOnError) {
|
|
466
|
+
// intent is not supported
|
|
467
|
+
var oError = new NavError("NavigationHandler.isIntentSupported.notSupported");
|
|
468
|
+
fnOnError(oError);
|
|
469
|
+
}
|
|
470
|
+
});
|
|
449
471
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
472
|
+
if (fnOnError) {
|
|
473
|
+
oSupportedPromise.fail(function () {
|
|
474
|
+
// technical error: could not determine if intent is supported
|
|
475
|
+
var oError = oNavHandler._createTechnicalError("NavigationHandler.isIntentSupported.failed");
|
|
476
|
+
fnOnError(oError);
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
})
|
|
480
|
+
.catch(function (oError) {
|
|
454
481
|
fnOnError(oError);
|
|
455
482
|
});
|
|
456
|
-
}
|
|
457
483
|
},
|
|
458
484
|
|
|
459
485
|
/**
|
|
@@ -579,49 +605,56 @@ sap.ui.define(
|
|
|
579
605
|
// no back navigation
|
|
580
606
|
var bIsXappStateNavigation = oComponentData["sap-xapp-state"] !== undefined;
|
|
581
607
|
if (bIsXappStateNavigation) {
|
|
608
|
+
var that = this;
|
|
582
609
|
// inner app state was not found in the AppHash, but xapp state => try to read the xapp state
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
if (oAppStateData) {
|
|
601
|
-
var oSelVar = new SelectionVariant(oAppStateData.selectionVariant);
|
|
610
|
+
this._getAppNavigationServiceAsync()
|
|
611
|
+
.then(function (oCrossAppNavService) {
|
|
612
|
+
var oStartupPromise = oCrossAppNavService.getStartupAppState(that.oComponent);
|
|
613
|
+
oStartupPromise.done(function (oAppState) {
|
|
614
|
+
// get app state from sap-xapp-state,
|
|
615
|
+
// create a copy, not only a reference, because we want to modify the object
|
|
616
|
+
var oAppStateData = oAppState.getData();
|
|
617
|
+
var oError;
|
|
618
|
+
if (oAppStateData) {
|
|
619
|
+
try {
|
|
620
|
+
oAppStateData = JSON.parse(JSON.stringify(oAppStateData));
|
|
621
|
+
} catch (x) {
|
|
622
|
+
oError = oNavHandler._createTechnicalError("NavigationHandler.AppStateData.parseError");
|
|
623
|
+
oMyDeferred.reject(oError, oStartupParameters, NavType.xAppState);
|
|
624
|
+
return oMyDeferred.promise();
|
|
625
|
+
}
|
|
626
|
+
}
|
|
602
627
|
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
628
|
+
if (oAppStateData) {
|
|
629
|
+
var oSelVar = new SelectionVariant(oAppStateData.selectionVariant);
|
|
630
|
+
|
|
631
|
+
var oSelVars = oNavHandler._splitInboundNavigationParameters(
|
|
632
|
+
oSelVar,
|
|
633
|
+
oStartupParameters,
|
|
634
|
+
aDefaultedParameters
|
|
635
|
+
);
|
|
636
|
+
oAppStateData.selectionVariant = oSelVars.oNavigationSelVar.toJSONString();
|
|
637
|
+
oAppStateData.oSelectionVariant = oSelVars.oNavigationSelVar;
|
|
638
|
+
oAppStateData.oDefaultedSelectionVariant = oSelVars.oDefaultedSelVar;
|
|
639
|
+
oAppStateData.bNavSelVarHasDefaultsOnly = oSelVars.bNavSelVarHasDefaultsOnly;
|
|
640
|
+
oMyDeferred.resolve(oAppStateData, oStartupParameters, NavType.xAppState);
|
|
641
|
+
} else if (oStartupParameters) {
|
|
642
|
+
parseUrlParams(oStartupParameters, aDefaultedParameters, oMyDeferred, NavType.xAppState);
|
|
643
|
+
} else {
|
|
644
|
+
// sap-xapp-state navigation, but ID has already expired, but URL parameters available
|
|
645
|
+
oError = oNavHandler._createTechnicalError("NavigationHandler.getDataFromAppState.failed");
|
|
646
|
+
oMyDeferred.reject(oError, oStartupParameters || {}, NavType.xAppState);
|
|
647
|
+
}
|
|
648
|
+
});
|
|
649
|
+
oStartupPromise.fail(function () {
|
|
650
|
+
var oError = oNavHandler._createTechnicalError("NavigationHandler.getStartupState.failed");
|
|
651
|
+
oMyDeferred.reject(oError, {}, NavType.xAppState);
|
|
652
|
+
});
|
|
653
|
+
})
|
|
654
|
+
.catch(function () {
|
|
655
|
+
var oError = oNavHandler._createTechnicalError("NavigationHandler._getAppNavigationServiceAsync.failed");
|
|
656
|
+
oMyDeferred.reject(oError, {}, NavType.xAppState);
|
|
657
|
+
});
|
|
625
658
|
} else if (oStartupParameters) {
|
|
626
659
|
// no sap-xapp-state
|
|
627
660
|
parseUrlParams(oStartupParameters, aDefaultedParameters, oMyDeferred, NavType.URLParams);
|
|
@@ -907,6 +940,8 @@ sap.ui.define(
|
|
|
907
940
|
* @param {object} [mInnerAppData.semanticDates] Object containing semanticDates filter information
|
|
908
941
|
* @param {boolean} [bImmediateHashReplace=true] If set to false, the inner app hash will not be replaced until storing is successful; do not
|
|
909
942
|
* 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
|
+
* will be ignored.
|
|
910
945
|
* @returns {object} A Promise object to monitor when all the actions of the function have been executed; if the execution is successful, the
|
|
911
946
|
* app state key is returned; if an error occurs, an object of type {@link sap.fe.navigation.NavError} is
|
|
912
947
|
* returned
|
|
@@ -933,7 +968,7 @@ sap.ui.define(
|
|
|
933
968
|
* });
|
|
934
969
|
* </code>
|
|
935
970
|
*/
|
|
936
|
-
storeInnerAppState: function (mInnerAppData, bImmediateHashReplace) {
|
|
971
|
+
storeInnerAppState: function (mInnerAppData, bImmediateHashReplace, bSkipHashReplace) {
|
|
937
972
|
if (typeof bImmediateHashReplace !== "boolean") {
|
|
938
973
|
bImmediateHashReplace = true; // default
|
|
939
974
|
}
|
|
@@ -976,7 +1011,7 @@ sap.ui.define(
|
|
|
976
1011
|
|
|
977
1012
|
var fnOnAfterSave = function (sAppStateKey) {
|
|
978
1013
|
// replace inner app hash with new appStateKey in url
|
|
979
|
-
if (!bImmediateHashReplace) {
|
|
1014
|
+
if (!bSkipHashReplace && !bImmediateHashReplace) {
|
|
980
1015
|
fnReplaceHash(sAppStateKey);
|
|
981
1016
|
}
|
|
982
1017
|
|
|
@@ -990,20 +1025,24 @@ sap.ui.define(
|
|
|
990
1025
|
oMyDeferred.reject(oError);
|
|
991
1026
|
};
|
|
992
1027
|
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1028
|
+
this._saveAppStateAsync(mInnerAppData, fnOnAfterSave, fnOnError)
|
|
1029
|
+
.then(function (sAppStateKey) {
|
|
1030
|
+
/* Note that _sapAppState may return 'undefined' in case that the parsing has failed. In this case, we should not trigger the replacement
|
|
1031
|
+
* of the App Hash with the generated key, as the container was not written before. Note as well that the error handling has already
|
|
1032
|
+
* happened before by making the oMyDeferred promise fail (see fnOnError above).
|
|
1033
|
+
*/
|
|
1034
|
+
if (sAppStateKey !== undefined) {
|
|
1035
|
+
// replace inner app hash with new appStateKey in url
|
|
1036
|
+
// note: we do not wait for the save to be completed: this asynchronously behaviour is necessary if
|
|
1037
|
+
// this method is called e.g. in a onLinkPressed event with no possibility to wait for the promise resolution
|
|
1038
|
+
if (!bSkipHashReplace && bImmediateHashReplace) {
|
|
1039
|
+
fnReplaceHash(sAppStateKey);
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
})
|
|
1043
|
+
.catch(function () {
|
|
1044
|
+
Log.error("NavigationHandler._saveAppStateAsync failed");
|
|
1045
|
+
});
|
|
1007
1046
|
|
|
1008
1047
|
return oMyDeferred.promise();
|
|
1009
1048
|
},
|
|
@@ -1052,8 +1091,14 @@ sap.ui.define(
|
|
|
1052
1091
|
* });
|
|
1053
1092
|
* </code>
|
|
1054
1093
|
* @public
|
|
1094
|
+
* @deprecated as of version 1.104. Use the {@link sap.fe.navigation.NavigationHandler.storeInnerAppState} instead.
|
|
1055
1095
|
*/
|
|
1056
1096
|
storeInnerAppStateWithImmediateReturn: function (mInnerAppData, bImmediateHashReplace) {
|
|
1097
|
+
Log.error(
|
|
1098
|
+
"Deprecated API call of 'sap.fe.navigation.NavigationHandler.storeInnerAppStateWithImmediateReturn'. Please use 'storeInnerAppState' instead",
|
|
1099
|
+
null,
|
|
1100
|
+
"sap.fe.navigation.NavigationHandler"
|
|
1101
|
+
);
|
|
1057
1102
|
if (typeof bImmediateHashReplace !== "boolean") {
|
|
1058
1103
|
bImmediateHashReplace = false; // default
|
|
1059
1104
|
}
|
|
@@ -1260,7 +1305,7 @@ sap.ui.define(
|
|
|
1260
1305
|
|
|
1261
1306
|
oXAppDataObj = oNavHandler._removeMeasureBasedInformation(oXAppDataObj);
|
|
1262
1307
|
|
|
1263
|
-
oNavHandler.
|
|
1308
|
+
oNavHandler._saveAppStateAsync(oXAppDataObj, fnOnContainerSave, fnOnError);
|
|
1264
1309
|
};
|
|
1265
1310
|
|
|
1266
1311
|
if (mInnerAppData) {
|
|
@@ -1477,32 +1522,56 @@ sap.ui.define(
|
|
|
1477
1522
|
|
|
1478
1523
|
return vConvertedSelectionVariant;
|
|
1479
1524
|
},
|
|
1525
|
+
_fnHandleAppStatePromise: function (oReturn, fnOnAfterSave, fnOnError) {
|
|
1526
|
+
oReturn.promise.done(function () {
|
|
1527
|
+
if (fnOnAfterSave) {
|
|
1528
|
+
fnOnAfterSave(oReturn.appStateKey);
|
|
1529
|
+
}
|
|
1530
|
+
});
|
|
1480
1531
|
|
|
1532
|
+
if (fnOnError) {
|
|
1533
|
+
var oNavHandler = this;
|
|
1534
|
+
oReturn.promise.fail(function () {
|
|
1535
|
+
var oError = oNavHandler._createTechnicalError("NavigationHandler.AppStateSave.failed");
|
|
1536
|
+
fnOnError(oError);
|
|
1537
|
+
});
|
|
1538
|
+
}
|
|
1539
|
+
},
|
|
1540
|
+
_saveAppStateAsync: function (oAppData, fnOnAfterSave, fnOnError) {
|
|
1541
|
+
var oNavHandler = this;
|
|
1542
|
+
return this._fnSaveAppStateAsync(oAppData, fnOnError).then(function (oReturn) {
|
|
1543
|
+
if (oReturn) {
|
|
1544
|
+
oNavHandler._fnHandleAppStatePromise(oReturn, fnOnAfterSave, fnOnError);
|
|
1545
|
+
return oReturn.appStateKey;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
return undefined;
|
|
1549
|
+
});
|
|
1550
|
+
},
|
|
1481
1551
|
_saveAppState: function (oAppData, fnOnAfterSave, fnOnError) {
|
|
1482
1552
|
var oReturn = this._saveAppStateWithImmediateReturn(oAppData, fnOnError);
|
|
1483
1553
|
if (oReturn) {
|
|
1484
|
-
|
|
1485
|
-
if (fnOnAfterSave) {
|
|
1486
|
-
fnOnAfterSave(oReturn.appStateKey);
|
|
1487
|
-
}
|
|
1488
|
-
});
|
|
1489
|
-
|
|
1490
|
-
if (fnOnError) {
|
|
1491
|
-
var oNavHandler = this;
|
|
1492
|
-
oReturn.promise.fail(function () {
|
|
1493
|
-
var oError = oNavHandler._createTechnicalError("NavigationHandler.AppStateSave.failed");
|
|
1494
|
-
fnOnError(oError);
|
|
1495
|
-
});
|
|
1496
|
-
}
|
|
1554
|
+
this._fnHandleAppStatePromise(oReturn, fnOnAfterSave, fnOnError);
|
|
1497
1555
|
return oReturn.appStateKey;
|
|
1498
1556
|
}
|
|
1499
1557
|
|
|
1500
1558
|
return undefined;
|
|
1501
1559
|
},
|
|
1502
|
-
|
|
1503
|
-
_saveAppStateWithImmediateReturn: function (oAppData, fnOnError) {
|
|
1504
|
-
var oAppState = this.oCrossAppNavService.createEmptyAppState(this.oComponent);
|
|
1560
|
+
_fnSaveAppStateWithImmediateReturn: function (oAppData, oAppState, fnOnError) {
|
|
1505
1561
|
var sAppStateKey = oAppState.getKey();
|
|
1562
|
+
var oAppDataForSave = this._fetchAppDataForSave(oAppData, fnOnError);
|
|
1563
|
+
if (!oAppDataForSave) {
|
|
1564
|
+
return undefined;
|
|
1565
|
+
}
|
|
1566
|
+
oAppState.setData(oAppDataForSave);
|
|
1567
|
+
var oSavePromise = oAppState.save();
|
|
1568
|
+
|
|
1569
|
+
return {
|
|
1570
|
+
appStateKey: sAppStateKey,
|
|
1571
|
+
promise: oSavePromise.promise()
|
|
1572
|
+
};
|
|
1573
|
+
},
|
|
1574
|
+
_fetchAppDataForSave: function (oAppData, fnOnError) {
|
|
1506
1575
|
var oAppDataForSave = {};
|
|
1507
1576
|
|
|
1508
1577
|
if (oAppData.hasOwnProperty("selectionVariant")) {
|
|
@@ -1557,80 +1626,103 @@ sap.ui.define(
|
|
|
1557
1626
|
oAppDataForSave = merge(oAppDataClone, oAppDataForSave);
|
|
1558
1627
|
}
|
|
1559
1628
|
oAppDataForSave = this._checkIsPotentiallySensitive(oAppDataForSave);
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1629
|
+
return oAppDataForSave;
|
|
1630
|
+
},
|
|
1631
|
+
_fnSaveAppStateAsync: function (oAppData, fnOnError) {
|
|
1632
|
+
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
|
+
});
|
|
1645
|
+
},
|
|
1646
|
+
_saveAppStateWithImmediateReturn: function (oAppData, fnOnError) {
|
|
1647
|
+
var oAppState = this._getAppNavigationService().createEmptyAppState(this.oComponent);
|
|
1648
|
+
return this._fnSaveAppStateWithImmediateReturn(oAppData, oAppState, fnOnError);
|
|
1567
1649
|
},
|
|
1568
1650
|
|
|
1569
1651
|
_loadAppState: function (sAppStateKey, oDeferred) {
|
|
1570
|
-
var oAppStatePromise = this.oCrossAppNavService.getAppState(this.oComponent, sAppStateKey);
|
|
1571
1652
|
var oNavHandler = this;
|
|
1653
|
+
this._getAppNavigationServiceAsync()
|
|
1654
|
+
.then(function (oCrossAppNavService) {
|
|
1655
|
+
var oAppStatePromise = oCrossAppNavService.getAppState(oNavHandler.oComponent, sAppStateKey);
|
|
1656
|
+
oAppStatePromise.done(function (oAppState) {
|
|
1657
|
+
var oAppData = {};
|
|
1658
|
+
var oAppDataLoaded = oAppState.getData();
|
|
1659
|
+
|
|
1660
|
+
if (typeof oAppDataLoaded === "undefined") {
|
|
1661
|
+
var oError = oNavHandler._createTechnicalError("NavigationHandler.getDataFromAppState.failed");
|
|
1662
|
+
oDeferred.reject(oError, {}, NavType.iAppState);
|
|
1663
|
+
} else if (oNavHandler._sMode === Mode.ODataV2) {
|
|
1664
|
+
oAppData = {
|
|
1665
|
+
selectionVariant: "{}",
|
|
1666
|
+
oSelectionVariant: new SelectionVariant(),
|
|
1667
|
+
oDefaultedSelectionVariant: new SelectionVariant(),
|
|
1668
|
+
bNavSelVarHasDefaultsOnly: false,
|
|
1669
|
+
tableVariantId: "",
|
|
1670
|
+
customData: {},
|
|
1671
|
+
appStateKey: sAppStateKey,
|
|
1672
|
+
presentationVariant: {},
|
|
1673
|
+
valueTexts: {},
|
|
1674
|
+
semanticDates: {}
|
|
1675
|
+
};
|
|
1676
|
+
if (oAppDataLoaded.selectionVariant) {
|
|
1677
|
+
/*
|
|
1678
|
+
* In case that we get an object from the stored AppData (=persistency), we need to stringify the JSON object.
|
|
1679
|
+
*/
|
|
1680
|
+
oAppData.selectionVariant = oNavHandler._ensureSelectionVariantFormatString(
|
|
1681
|
+
oAppDataLoaded.selectionVariant
|
|
1682
|
+
);
|
|
1683
|
+
oAppData.oSelectionVariant = new SelectionVariant(oAppData.selectionVariant);
|
|
1684
|
+
}
|
|
1685
|
+
if (oAppDataLoaded.tableVariantId) {
|
|
1686
|
+
oAppData.tableVariantId = oAppDataLoaded.tableVariantId;
|
|
1687
|
+
}
|
|
1688
|
+
if (oAppDataLoaded.customData) {
|
|
1689
|
+
oAppData.customData = oAppDataLoaded.customData;
|
|
1690
|
+
}
|
|
1691
|
+
if (oAppDataLoaded.presentationVariant) {
|
|
1692
|
+
oAppData.presentationVariant = oAppDataLoaded.presentationVariant;
|
|
1693
|
+
}
|
|
1694
|
+
if (oAppDataLoaded.valueTexts) {
|
|
1695
|
+
oAppData.valueTexts = oAppDataLoaded.valueTexts;
|
|
1696
|
+
}
|
|
1697
|
+
if (oAppDataLoaded.semanticDates) {
|
|
1698
|
+
oAppData.semanticDates = oAppDataLoaded.semanticDates;
|
|
1699
|
+
}
|
|
1700
|
+
} else {
|
|
1701
|
+
oAppData = merge(oAppData, oAppDataLoaded);
|
|
1702
|
+
if (oAppDataLoaded.selectionVariant) {
|
|
1703
|
+
/*
|
|
1704
|
+
* In case that we get an object from the stored AppData (=persistency), we need to stringify the JSON object.
|
|
1705
|
+
*/
|
|
1706
|
+
oAppData.selectionVariant = oNavHandler._ensureSelectionVariantFormatString(
|
|
1707
|
+
oAppDataLoaded.selectionVariant
|
|
1708
|
+
);
|
|
1709
|
+
oAppData.oSelectionVariant = new SelectionVariant(oAppData.selectionVariant);
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1572
1712
|
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1713
|
+
// resolve is called on passed Deferred object to trigger a call of the done method, if implemented
|
|
1714
|
+
// the done method will receive the loaded appState and the navigation type as parameters
|
|
1715
|
+
oDeferred.resolve(oAppData, {}, NavType.iAppState);
|
|
1716
|
+
});
|
|
1717
|
+
oAppStatePromise.fail(function () {
|
|
1718
|
+
var oError = oNavHandler._createTechnicalError("NavigationHandler.getAppState.failed");
|
|
1719
|
+
oDeferred.reject(oError, {}, NavType.iAppState);
|
|
1720
|
+
});
|
|
1721
|
+
})
|
|
1722
|
+
.catch(function () {
|
|
1723
|
+
var oError = oNavHandler._createTechnicalError("NavigationHandler._getAppNavigationServiceAsync.failed");
|
|
1579
1724
|
oDeferred.reject(oError, {}, NavType.iAppState);
|
|
1580
|
-
}
|
|
1581
|
-
oAppData = {
|
|
1582
|
-
selectionVariant: "{}",
|
|
1583
|
-
oSelectionVariant: new SelectionVariant(),
|
|
1584
|
-
oDefaultedSelectionVariant: new SelectionVariant(),
|
|
1585
|
-
bNavSelVarHasDefaultsOnly: false,
|
|
1586
|
-
tableVariantId: "",
|
|
1587
|
-
customData: {},
|
|
1588
|
-
appStateKey: sAppStateKey,
|
|
1589
|
-
presentationVariant: {},
|
|
1590
|
-
valueTexts: {},
|
|
1591
|
-
semanticDates: {}
|
|
1592
|
-
};
|
|
1593
|
-
if (oAppDataLoaded.selectionVariant) {
|
|
1594
|
-
/*
|
|
1595
|
-
* In case that we get an object from the stored AppData (=persistency), we need to stringify the JSON object.
|
|
1596
|
-
*/
|
|
1597
|
-
oAppData.selectionVariant = oNavHandler._ensureSelectionVariantFormatString(oAppDataLoaded.selectionVariant);
|
|
1598
|
-
oAppData.oSelectionVariant = new SelectionVariant(oAppData.selectionVariant);
|
|
1599
|
-
}
|
|
1600
|
-
if (oAppDataLoaded.tableVariantId) {
|
|
1601
|
-
oAppData.tableVariantId = oAppDataLoaded.tableVariantId;
|
|
1602
|
-
}
|
|
1603
|
-
if (oAppDataLoaded.customData) {
|
|
1604
|
-
oAppData.customData = oAppDataLoaded.customData;
|
|
1605
|
-
}
|
|
1606
|
-
if (oAppDataLoaded.presentationVariant) {
|
|
1607
|
-
oAppData.presentationVariant = oAppDataLoaded.presentationVariant;
|
|
1608
|
-
}
|
|
1609
|
-
if (oAppDataLoaded.valueTexts) {
|
|
1610
|
-
oAppData.valueTexts = oAppDataLoaded.valueTexts;
|
|
1611
|
-
}
|
|
1612
|
-
if (oAppDataLoaded.semanticDates) {
|
|
1613
|
-
oAppData.semanticDates = oAppDataLoaded.semanticDates;
|
|
1614
|
-
}
|
|
1615
|
-
} else {
|
|
1616
|
-
oAppData = merge(oAppData, oAppDataLoaded);
|
|
1617
|
-
if (oAppDataLoaded.selectionVariant) {
|
|
1618
|
-
/*
|
|
1619
|
-
* In case that we get an object from the stored AppData (=persistency), we need to stringify the JSON object.
|
|
1620
|
-
*/
|
|
1621
|
-
oAppData.selectionVariant = oNavHandler._ensureSelectionVariantFormatString(oAppDataLoaded.selectionVariant);
|
|
1622
|
-
oAppData.oSelectionVariant = new SelectionVariant(oAppData.selectionVariant);
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
// resolve is called on passed Deferred object to trigger a call of the done method, if implemented
|
|
1627
|
-
// the done method will receive the loaded appState and the navigation type as parameters
|
|
1628
|
-
oDeferred.resolve(oAppData, {}, NavType.iAppState);
|
|
1629
|
-
});
|
|
1630
|
-
oAppStatePromise.fail(function () {
|
|
1631
|
-
var oError = oNavHandler._createTechnicalError("NavigationHandler.getAppState.failed");
|
|
1632
|
-
oDeferred.reject(oError, {}, NavType.iAppState);
|
|
1633
|
-
});
|
|
1725
|
+
});
|
|
1634
1726
|
},
|
|
1635
1727
|
|
|
1636
1728
|
/**
|
|
@@ -19,7 +19,7 @@ sap.ui.define(
|
|
|
19
19
|
* @class
|
|
20
20
|
* @public
|
|
21
21
|
* @since 1.83.0
|
|
22
|
-
* @
|
|
22
|
+
* @name sap.fe.navigation.PresentationVariant
|
|
23
23
|
* @param {string|object} [vPresentationVariant] If of type <code>string</code>, the selection variant is JSON-formatted;
|
|
24
24
|
* if of type <code>object</code>, the object represents a selection variant
|
|
25
25
|
* @throws An instance of {@link sap.fe.navigation.NavError} in case of input errors. Valid error codes are:
|
|
@@ -36,7 +36,7 @@ sap.ui.define(
|
|
|
36
36
|
*/
|
|
37
37
|
return BaseObject.extend(
|
|
38
38
|
"sap.fe.navigation.PresentationVariant",
|
|
39
|
-
/** @lends sap.fe.navigation.PresentationVariant */ {
|
|
39
|
+
/** @lends sap.fe.navigation.PresentationVariant.prototype */ {
|
|
40
40
|
constructor: function (vPresentationVariant) {
|
|
41
41
|
this._sId = "";
|
|
42
42
|
|
|
@@ -19,7 +19,7 @@ sap.ui.define(
|
|
|
19
19
|
* @class
|
|
20
20
|
* @public
|
|
21
21
|
* @since 1.83.0
|
|
22
|
-
* @
|
|
22
|
+
* @name sap.fe.navigation.SelectionVariant
|
|
23
23
|
* @param {string|object} [vSelectionVariant] If of type <code>string</code>, the selection variant is JSON-formatted;
|
|
24
24
|
* if of type <code>object</code>, the object represents a selection variant
|
|
25
25
|
* @throws An instance of {@link sap.fe.navigation.NavError} in case of input errors. Valid error codes are:
|
|
@@ -36,7 +36,7 @@ sap.ui.define(
|
|
|
36
36
|
*/
|
|
37
37
|
return BaseObject.extend(
|
|
38
38
|
"sap.fe.navigation.SelectionVariant",
|
|
39
|
-
/** @lends sap.fe.navigation.SelectionVariant */
|
|
39
|
+
/** @lends sap.fe.navigation.SelectionVariant.prototype */
|
|
40
40
|
{
|
|
41
41
|
_rVALIDATE_SIGN: new RegExp("[E|I]"),
|
|
42
42
|
_rVALIDATE_OPTION: new RegExp("EQ|NE|LE|GE|LT|GT|BT|CP"),
|
|
@@ -307,8 +307,8 @@ sap.ui.define(
|
|
|
307
307
|
* (ABAP-styled pattern matching with the asterisk as wildcard)
|
|
308
308
|
* @param {string} sLow The single value or the lower boundary of the interval; the <code>null</code> value is not allowed
|
|
309
309
|
* @param {string} [sHigh] Set only if sOption is <b>BT</b>: the upper boundary of the interval;
|
|
310
|
-
* @param {string} [sText] Text representing the SelectOption. This is an optional parameter, consumption of this parameter is
|
|
311
|
-
* completely decided by the consumer. For an example in most Fiori applications fetch the Text based on the ID and doesn't
|
|
310
|
+
* @param {string} [sText] Text representing the SelectOption. This is an optional parameter, consumption of this parameter is
|
|
311
|
+
* completely decided by the consumer. For an example in most Fiori applications fetch the Text based on the ID and doesn't
|
|
312
312
|
* consider this text property
|
|
313
313
|
* must be <code>undefined</code> or <code>null</code> in all other cases
|
|
314
314
|
* @returns {object} This instance to allow method chaining.
|
|
@@ -324,7 +324,7 @@ sap.ui.define(
|
|
|
324
324
|
* <tr><td>SelectionVariant.PARAMETER_SELOPT_COLLISION</td><td>Indicates that another parameter with the same name as the property name already exists</td></tr>
|
|
325
325
|
* </table>
|
|
326
326
|
*/
|
|
327
|
-
addSelectOption: function(sPropertyName, sSign, sOption, sLow, sHigh, sText) {
|
|
327
|
+
addSelectOption: function (sPropertyName, sSign, sOption, sLow, sHigh, sText) {
|
|
328
328
|
/* {string} sLow The single value or the lower boundary of the interval; the <code>null</code> value is not allowed
|
|
329
329
|
* (see specification "Selection Variants for UI Navigation in Fiori", section 2.4.2.1)
|
|
330
330
|
*/
|
|
@@ -378,7 +378,7 @@ sap.ui.define(
|
|
|
378
378
|
};
|
|
379
379
|
|
|
380
380
|
if (sText) {
|
|
381
|
-
// Add Text property only in case it is passed by the consumer of the API.
|
|
381
|
+
// Add Text property only in case it is passed by the consumer of the API.
|
|
382
382
|
// Otherwise keep the structure as is.
|
|
383
383
|
oEntry.Text = sText;
|
|
384
384
|
}
|
|
@@ -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.
|
|
29
|
+
version: "1.104.1",
|
|
30
30
|
dependencies: ["sap.ui.core"],
|
|
31
31
|
types: ["sap.fe.navigation.NavType", "sap.fe.navigation.ParamHandlingMode", "sap.fe.navigation.SuppressionBehavior"],
|
|
32
32
|
interfaces: [],
|