@sapui5/sap.ushell_abap 1.139.0 → 1.140.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 +1 -1
- package/src/main/js/sap/ushell_abap/.library +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/AdapterContainer.js +7 -4
- package/src/main/js/sap/ushell_abap/adapters/abap/AppStateAdapter.js +3 -3
- package/src/main/js/sap/ushell_abap/adapters/abap/ClientSideTargetResolutionAdapter.js +45 -48
- package/src/main/js/sap/ushell_abap/adapters/abap/CommonDataModelAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/ConfigurationDefaultsAdapter.js +1 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/ContainerAdapter.js +8 -8
- package/src/main/js/sap/ushell_abap/adapters/abap/FlpLaunchPageAdapter.js +83 -79
- package/src/main/js/sap/ushell_abap/adapters/abap/LaunchPageAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/MenuAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/NavTargetResolutionAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/NavTargetResolutionInternalAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/PageBuildingAdapter.js +10 -12
- package/src/main/js/sap/ushell_abap/adapters/abap/PagePersistenceAdapter.js +3 -3
- package/src/main/js/sap/ushell_abap/adapters/abap/PersonalizationAdapter.js +3 -3
- package/src/main/js/sap/ushell_abap/adapters/abap/PersonalizationV2Adapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/SearchAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/SupportTicketAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/Ui5ComponentLoaderAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/UserInfoAdapter.js +6 -8
- package/src/main/js/sap/ushell_abap/adapters/hana/ContainerAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/SAPCompanionConditionSetter.js +4 -4
- package/src/main/js/sap/ushell_abap/bootstrap/evo/XhrLogonEventHandler.js +5 -2
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.bootstrap.utils.js +2 -2
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.configure.ushell.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.pageset.js +53 -30
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.theme.handler.js +2 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/boottask.js +27 -18
- package/src/main/js/sap/ushell_abap/components/TCodeNavigation.js +150 -0
- package/src/main/js/sap/ushell_abap/library.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/AllCatalogs.js +2 -2
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Bag.js +4 -8
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Catalog.js +17 -15
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Chip.js +10 -15
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipDefinition.js +4 -5
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipInstance.js +4 -5
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Error.js +2 -2
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Factory.js +12 -20
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataService.js +9 -12
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataWrapper.js +28 -28
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Page.js +3 -5
- package/src/main/js/sap/ushell_abap/pbServices/ui2/PageBuildingService.js +19 -22
- package/src/main/js/sap/ushell_abap/pbServices/ui2/PageSet.js +9 -10
- package/src/main/js/sap/ushell_abap/pbServices/ui2/RemoteCatalogService.js +2 -2
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Utils.js +13 -60
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/actions.js +1 -2
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configuration.js +1 -1
|
@@ -49,7 +49,24 @@ sap.ui.define([
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Clones an Object to avoid unwanted changes
|
|
54
|
+
* @param {object} oInputObject
|
|
55
|
+
* The object that needs to be cloned
|
|
56
|
+
* @returns {object}
|
|
57
|
+
* The cloned object
|
|
58
|
+
* @private
|
|
59
|
+
*/
|
|
60
|
+
function cloneObject (oInputObject) {
|
|
61
|
+
if (oInputObject === undefined) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
return JSON.parse(JSON.stringify(oInputObject));
|
|
66
|
+
} catch (e) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
53
70
|
|
|
54
71
|
// "public class" ************************************************************
|
|
55
72
|
|
|
@@ -100,13 +117,15 @@ sap.ui.define([
|
|
|
100
117
|
* @since 1.19.0
|
|
101
118
|
*/
|
|
102
119
|
// OLD API: function (sBaseUrl, oODataService, bSupportsChangeSets)
|
|
103
|
-
ODataWrapper
|
|
120
|
+
function ODataWrapper (oSettings, oODataService) {
|
|
104
121
|
const S_STICKY_SESSION_HEADER = "saplb"; // header to check during sticky session
|
|
105
122
|
let aBatchQueue; // corresponds to data.__batchRequests
|
|
106
123
|
let bChangeSetOpen; // whether a change set is currently open at the end of our batch queue
|
|
107
124
|
let aDeferredQueue; // jQuery.Deferred() objects corresponding to each request
|
|
108
125
|
const that = this;
|
|
126
|
+
// eslint-disable-next-line prefer-const
|
|
109
127
|
let sBaseUrl;
|
|
128
|
+
// eslint-disable-next-line prefer-const
|
|
110
129
|
let bSupportsChangeSets;
|
|
111
130
|
|
|
112
131
|
// BEWARE: constructor code below!
|
|
@@ -137,7 +156,7 @@ sap.ui.define([
|
|
|
137
156
|
/**
|
|
138
157
|
* Getter mainly used for testing.
|
|
139
158
|
*
|
|
140
|
-
* @returns {object}
|
|
159
|
+
* @returns {object} the batch queue
|
|
141
160
|
*/
|
|
142
161
|
this.getBatchQueue = function () {
|
|
143
162
|
return aBatchQueue;
|
|
@@ -244,7 +263,6 @@ sap.ui.define([
|
|
|
244
263
|
* the response headers
|
|
245
264
|
*/
|
|
246
265
|
this.detectStickySession = function (oResponseHeaders) {
|
|
247
|
-
let sHeaderValue;
|
|
248
266
|
const oStickySessionConfiguration =
|
|
249
267
|
ODataWrapper.oStickySessionConfiguration[sBaseUrl];
|
|
250
268
|
|
|
@@ -253,7 +271,7 @@ sap.ui.define([
|
|
|
253
271
|
}
|
|
254
272
|
|
|
255
273
|
// add sticky session header value if found
|
|
256
|
-
sHeaderValue = ODataWrapper.headerValue(S_STICKY_SESSION_HEADER, oResponseHeaders);
|
|
274
|
+
const sHeaderValue = ODataWrapper.headerValue(S_STICKY_SESSION_HEADER, oResponseHeaders);
|
|
257
275
|
if (typeof sHeaderValue === "undefined") {
|
|
258
276
|
return;
|
|
259
277
|
}
|
|
@@ -315,11 +333,10 @@ sap.ui.define([
|
|
|
315
333
|
*/
|
|
316
334
|
this.doRequest = function (sRequestUrl, sMethod, oPayload, fnSuccess, fnFailure, oHandler, bIsRepeatedRequest) {
|
|
317
335
|
Log.debug("[000] do request, sMethod", sMethod, "ODataWrapper");
|
|
318
|
-
let oHeaders;
|
|
319
336
|
fnSuccess = fnSuccess || nop;
|
|
320
337
|
fnFailure = fnFailure || oODataService.getDefaultErrorHandler();
|
|
321
338
|
that.check(fnSuccess, fnFailure);
|
|
322
|
-
oHeaders = {
|
|
339
|
+
const oHeaders = {
|
|
323
340
|
Accept: "application/json",
|
|
324
341
|
"Accept-Language": Localization.getLanguage() || "",
|
|
325
342
|
"X-CSRF-Token": oODataService.getCsrfToken()
|
|
@@ -859,6 +876,8 @@ sap.ui.define([
|
|
|
859
876
|
|
|
860
877
|
/**
|
|
861
878
|
* Success handler for <code>OData.read</code>.
|
|
879
|
+
* @param {object} oData oData returned by the OData service
|
|
880
|
+
* @param {object} oResponse response object
|
|
862
881
|
*/
|
|
863
882
|
function success (oData, oResponse) {
|
|
864
883
|
this.detectStickySession(oResponse.headers);
|
|
@@ -968,7 +987,7 @@ sap.ui.define([
|
|
|
968
987
|
/**
|
|
969
988
|
* Success handler for $batch request.
|
|
970
989
|
*
|
|
971
|
-
* @param {object} oData
|
|
990
|
+
* @param {object} oData is the oData response object
|
|
972
991
|
*/
|
|
973
992
|
function onBatchSuccess (oData) {
|
|
974
993
|
const iActual = oData.__batchResponses.length;
|
|
@@ -1135,7 +1154,7 @@ sap.ui.define([
|
|
|
1135
1154
|
value: undefined // the value detected if enabled = true
|
|
1136
1155
|
};
|
|
1137
1156
|
}
|
|
1138
|
-
}
|
|
1157
|
+
}
|
|
1139
1158
|
|
|
1140
1159
|
/**
|
|
1141
1160
|
* Detects and, if needed, converts old api calls of the createODataWrapper function to the current one.
|
|
@@ -1162,25 +1181,6 @@ sap.ui.define([
|
|
|
1162
1181
|
return oTransformedApi;
|
|
1163
1182
|
}
|
|
1164
1183
|
|
|
1165
|
-
/**
|
|
1166
|
-
* Clones an Object to avoid unwanted changes
|
|
1167
|
-
* @param {object} oInputObject
|
|
1168
|
-
* The object that needs to be cloned
|
|
1169
|
-
* @returns {object}
|
|
1170
|
-
* The cloned object
|
|
1171
|
-
* @private
|
|
1172
|
-
*/
|
|
1173
|
-
function cloneObject (oInputObject) {
|
|
1174
|
-
if (oInputObject === undefined) {
|
|
1175
|
-
return undefined;
|
|
1176
|
-
}
|
|
1177
|
-
try {
|
|
1178
|
-
return JSON.parse(JSON.stringify(oInputObject));
|
|
1179
|
-
} catch (e) {
|
|
1180
|
-
return undefined;
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
1184
|
/*
|
|
1185
1185
|
* Configuration for sticky session is done here as it is a static property
|
|
1186
1186
|
* that should not rely on the instance initialization. Also, it may happen
|
|
@@ -46,7 +46,7 @@ sap.ui.define([
|
|
|
46
46
|
* @since 1.2.0
|
|
47
47
|
* @see sap.ushell_abap.pbServices.ui2.PageBuildingService
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
function Page (oFactory, vPageData) {
|
|
50
50
|
let sId; // the page ID
|
|
51
51
|
let oAllCatalogs;
|
|
52
52
|
let oAlterEgo; // page's representation with all relations removed
|
|
@@ -322,8 +322,6 @@ sap.ui.define([
|
|
|
322
322
|
* @since 1.3.0
|
|
323
323
|
*/
|
|
324
324
|
this.getBag = function (sBagId) {
|
|
325
|
-
let oBag;
|
|
326
|
-
|
|
327
325
|
if (bIsLoadingBagsOnDemand) {
|
|
328
326
|
throw new SrvcError(`${that}: page is just a stub, load bags on demand`,
|
|
329
327
|
"Page");
|
|
@@ -337,7 +335,7 @@ sap.ui.define([
|
|
|
337
335
|
return mBags.get(sBagId);
|
|
338
336
|
}
|
|
339
337
|
|
|
340
|
-
oBag = new Bag(oFactory, { pageId: this.getId(), id: sBagId, $tmp: true });
|
|
338
|
+
const oBag = new Bag(oFactory, { pageId: this.getId(), id: sBagId, $tmp: true });
|
|
341
339
|
mBags.put(sBagId, oBag);
|
|
342
340
|
return oBag;
|
|
343
341
|
};
|
|
@@ -909,7 +907,7 @@ sap.ui.define([
|
|
|
909
907
|
}
|
|
910
908
|
mBags = new Utils.Map();
|
|
911
909
|
Log.debug(`Created: ${this}`, null, "Page");
|
|
912
|
-
}
|
|
910
|
+
}
|
|
913
911
|
|
|
914
912
|
return Page;
|
|
915
913
|
});
|
|
@@ -58,7 +58,7 @@ sap.ui.define([
|
|
|
58
58
|
* @augments ODataService
|
|
59
59
|
* @since 1.2.0
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
function PageBuildingService (vODataBase, fnDefaultFailure, bIsPersonalization, sCacheId) {
|
|
62
62
|
let oWrapper;
|
|
63
63
|
const that = this;
|
|
64
64
|
|
|
@@ -117,10 +117,10 @@ sap.ui.define([
|
|
|
117
117
|
/**
|
|
118
118
|
* Evaluates status code from OData batch response entry and returns the corresponding OData
|
|
119
119
|
* entity or the status message.
|
|
120
|
-
* @param oEntry The batch response entry which is an element of
|
|
120
|
+
* @param {object} oEntry The batch response entry which is an element of
|
|
121
121
|
* (For change) oData.__batchResponses[0]._changeResponses array
|
|
122
122
|
* (For read) oData.__batchResponses array (without the element for change responses)
|
|
123
|
-
* @returns OData entity (object or undefined) or status message as string
|
|
123
|
+
* @returns {object} OData entity (object or undefined) or status message as string
|
|
124
124
|
*
|
|
125
125
|
* @private
|
|
126
126
|
*/
|
|
@@ -264,7 +264,7 @@ sap.ui.define([
|
|
|
264
264
|
// Note: drop excess parameters; try/catch
|
|
265
265
|
Utils.callHandler(fnSuccess.bind(null, oData), fnFailure);
|
|
266
266
|
}, oWrapper.onError.bind(oWrapper, "GET", sRequestUrl, fnFailure, /* oDeferred */undefined),
|
|
267
|
-
|
|
267
|
+
OData.metadataHandler);
|
|
268
268
|
};
|
|
269
269
|
|
|
270
270
|
/**
|
|
@@ -601,9 +601,9 @@ sap.ui.define([
|
|
|
601
601
|
oWrapper.create(`CloneCatalog?sourceId='${encodeURIComponent(sCatalogId)
|
|
602
602
|
}'&targetId='${encodeURIComponent(sNewDomainId)
|
|
603
603
|
}${sNewTitle !== undefined ? `'&title='${encodeURIComponent(sNewTitle)}'` : "'"}`,
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
604
|
+
{}, // payload
|
|
605
|
+
fnSuccess,
|
|
606
|
+
fnFailure);
|
|
607
607
|
};
|
|
608
608
|
|
|
609
609
|
/**
|
|
@@ -646,17 +646,17 @@ sap.ui.define([
|
|
|
646
646
|
oWrapper.create(`ClonePageChipInstance?sourcePageId='${encodeURIComponent(sSourcePageId)
|
|
647
647
|
}'&sourceChipInstanceId='${encodeURIComponent(sSourceChipInstanceId)
|
|
648
648
|
}'&targetPageId='${encodeURIComponent(sTargetPageId)}'`,
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
649
|
+
{}, // payload
|
|
650
|
+
(oRawChipInstance) => {
|
|
651
|
+
// ClonePageChipInstance cannot expand the result
|
|
652
|
+
// Note: the CHIP instance cannot be remote and the CHIP has already been loaded
|
|
653
|
+
oWrapper.read(`PageChipInstances(pageId='${encodeURIComponent(oRawChipInstance.pageId)
|
|
654
654
|
}',instanceId='${encodeURIComponent(oRawChipInstance.instanceId)}')`
|
|
655
655
|
+ "?$expand=ChipInstanceBags/ChipInstanceProperties",
|
|
656
|
-
|
|
657
|
-
fnFailure);
|
|
658
|
-
},
|
|
656
|
+
fnSuccess,
|
|
659
657
|
fnFailure);
|
|
658
|
+
},
|
|
659
|
+
fnFailure);
|
|
660
660
|
};
|
|
661
661
|
|
|
662
662
|
/**
|
|
@@ -736,7 +736,6 @@ sap.ui.define([
|
|
|
736
736
|
* @since 1.16.4
|
|
737
737
|
*/
|
|
738
738
|
this.readCatalogChips = function (sCatalogId, aChipIds, fnSuccess, fnFailure) {
|
|
739
|
-
let sUrl;
|
|
740
739
|
let sFilter = "";
|
|
741
740
|
let sPrefix = "?$filter=";
|
|
742
741
|
|
|
@@ -745,7 +744,7 @@ sap.ui.define([
|
|
|
745
744
|
}
|
|
746
745
|
|
|
747
746
|
// TODO: read also CHIP bags
|
|
748
|
-
sUrl = `Catalogs('${encodeURIComponent(sCatalogId)}')/Chips`;
|
|
747
|
+
const sUrl = `Catalogs('${encodeURIComponent(sCatalogId)}')/Chips`;
|
|
749
748
|
if (aChipIds) {
|
|
750
749
|
if (!aChipIds.length) {
|
|
751
750
|
throw new SrvcError("No CHIP IDs given", "PageBuildingService");
|
|
@@ -1133,7 +1132,7 @@ sap.ui.define([
|
|
|
1133
1132
|
|
|
1134
1133
|
oWrapper.del(`PageChipInstances(pageId='${encodeURIComponent(sPageId)
|
|
1135
1134
|
}',instanceId='${encodeURIComponent(sInstanceId)}')`,
|
|
1136
|
-
|
|
1135
|
+
fnSuccess, fnFailure);
|
|
1137
1136
|
};
|
|
1138
1137
|
|
|
1139
1138
|
/**
|
|
@@ -1334,8 +1333,6 @@ sap.ui.define([
|
|
|
1334
1333
|
*/
|
|
1335
1334
|
this.createProperty = function (vParent, sBagId, sPropertyName, sValue, sTranslatable,
|
|
1336
1335
|
fnSuccess, fnFailure) {
|
|
1337
|
-
let oProperty;
|
|
1338
|
-
|
|
1339
1336
|
if (!vParent) {
|
|
1340
1337
|
throw new SrvcError("Missing parent ID or object",
|
|
1341
1338
|
"PageBuildingService");
|
|
@@ -1353,7 +1350,7 @@ sap.ui.define([
|
|
|
1353
1350
|
return;
|
|
1354
1351
|
}
|
|
1355
1352
|
|
|
1356
|
-
oProperty = {
|
|
1353
|
+
const oProperty = {
|
|
1357
1354
|
bagId: sBagId,
|
|
1358
1355
|
name: sPropertyName,
|
|
1359
1356
|
pageId: vParent,
|
|
@@ -1466,7 +1463,7 @@ sap.ui.define([
|
|
|
1466
1463
|
}
|
|
1467
1464
|
|
|
1468
1465
|
ODataService.call(this, oWrapper, fnDefaultFailure);
|
|
1469
|
-
}
|
|
1466
|
+
}
|
|
1470
1467
|
|
|
1471
1468
|
PageBuildingService._createODataWrapper = function (vODataBase, base) {
|
|
1472
1469
|
return new ODataWrapper(vODataBase, base, /* bSupportsChangeSets=*/true);
|
|
@@ -41,8 +41,7 @@ sap.ui.define([
|
|
|
41
41
|
* @since 1.11.0
|
|
42
42
|
* @private
|
|
43
43
|
*/
|
|
44
|
-
|
|
45
|
-
let sId; // the page set ID
|
|
44
|
+
function PageSet (oFactory, sPageSetId) {
|
|
46
45
|
let oAlterEgo; // page set's representation with all relations removed
|
|
47
46
|
let oDefaultPage;
|
|
48
47
|
let aPages = [];
|
|
@@ -50,6 +49,13 @@ sap.ui.define([
|
|
|
50
49
|
let bIsStub = true;
|
|
51
50
|
const that = this;
|
|
52
51
|
|
|
52
|
+
// constructor code -------------------------------------------------------
|
|
53
|
+
const sId = sPageSetId;
|
|
54
|
+
if (!sId) {
|
|
55
|
+
throw new SrvcError("Missing page set ID", "PageSet");
|
|
56
|
+
}
|
|
57
|
+
Log.debug(`Created: ${this}`, null, "PageSet");
|
|
58
|
+
|
|
53
59
|
/**
|
|
54
60
|
* Makes sure the given page set is not just a stub.
|
|
55
61
|
*
|
|
@@ -453,14 +459,7 @@ sap.ui.define([
|
|
|
453
459
|
aResult.push("})");
|
|
454
460
|
return aResult.join("");
|
|
455
461
|
};
|
|
456
|
-
|
|
457
|
-
// constructor code -------------------------------------------------------
|
|
458
|
-
sId = sPageSetId;
|
|
459
|
-
if (!sId) {
|
|
460
|
-
throw new SrvcError("Missing page set ID", "PageSet");
|
|
461
|
-
}
|
|
462
|
-
Log.debug(`Created: ${this}`, null, "PageSet");
|
|
463
|
-
};
|
|
462
|
+
}
|
|
464
463
|
|
|
465
464
|
return PageSet;
|
|
466
465
|
});
|
|
@@ -18,7 +18,7 @@ sap.ui.define([
|
|
|
18
18
|
* @class
|
|
19
19
|
* @since 1.19.1
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
function RemoteCatalogService () {
|
|
22
22
|
// "public" methods --------------------------------------------------------
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -44,7 +44,7 @@ sap.ui.define([
|
|
|
44
44
|
PageBuildingService.createPageBuildingService(sBaseUrl)
|
|
45
45
|
.readCatalogChips(sCatalogId, aChipIds, fnSuccess, fnFailure);
|
|
46
46
|
};
|
|
47
|
-
}
|
|
47
|
+
}
|
|
48
48
|
|
|
49
49
|
return RemoteCatalogService;
|
|
50
50
|
});
|
|
@@ -19,48 +19,7 @@ sap.ui.define([
|
|
|
19
19
|
) => {
|
|
20
20
|
"use strict";
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// ensure that Function.prototype.bind is available, even with iOS 5
|
|
25
|
-
// utils.js is used with startup service, shell API and page building services
|
|
26
|
-
if (!Function.prototype.bind) {
|
|
27
|
-
/**
|
|
28
|
-
* Replacement for ECMAScript 5 feature which might still be missing.
|
|
29
|
-
*
|
|
30
|
-
* @param {object} oThis
|
|
31
|
-
* The value to be passed as the <code>this</code> parameter to the target
|
|
32
|
-
* function when the bound function is called. The value is ignored if the
|
|
33
|
-
* bound function is constructed using the <code>new</code> operator.
|
|
34
|
-
* @param {...object} aVarArgs
|
|
35
|
-
* Arguments to prepend to arguments provided to the bound function when
|
|
36
|
-
* invoking the target function.
|
|
37
|
-
* @returns {function}
|
|
38
|
-
* A function with the bound arguments aVarArgs
|
|
39
|
-
*
|
|
40
|
-
* @see <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind">bind in ECMAScript 5</a>
|
|
41
|
-
*/
|
|
42
|
-
Function.prototype.bind = function (oThis) {
|
|
43
|
-
/* eslint-enable no-extend-native */
|
|
44
|
-
if (typeof this !== "function") {
|
|
45
|
-
// closest thing possible to the ECMAScript 5 internal IsCallable function
|
|
46
|
-
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const aArgs = Array.prototype.slice.call(arguments, 1);
|
|
50
|
-
const that = this;
|
|
51
|
-
const NOP = function () { /* no-op c'tor */ };
|
|
52
|
-
const fBound = function () {
|
|
53
|
-
return that.apply(
|
|
54
|
-
// passing "window" as "this" has been removed (cf. "use strict";)
|
|
55
|
-
this instanceof NOP ? this : oThis,
|
|
56
|
-
aArgs.concat(Array.prototype.slice.call(arguments))
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
NOP.prototype = this.prototype;
|
|
60
|
-
fBound.prototype = new NOP();
|
|
61
|
-
return fBound;
|
|
62
|
-
};
|
|
63
|
-
}
|
|
22
|
+
function Utils () { }
|
|
64
23
|
|
|
65
24
|
// cache for GET requests
|
|
66
25
|
let oCache;
|
|
@@ -85,7 +44,7 @@ sap.ui.define([
|
|
|
85
44
|
/* jslint regexp: true */
|
|
86
45
|
|
|
87
46
|
// default base is the page location
|
|
88
|
-
sBase = sBase || location.href;
|
|
47
|
+
sBase = sBase || window.location.href;
|
|
89
48
|
// base must be absolute
|
|
90
49
|
if (sBase.indexOf("://") < 0 && sBase.charAt(0) !== "/") {
|
|
91
50
|
throw new SrvcError(`Illegal base URL: ${sBase}`);
|
|
@@ -285,15 +244,10 @@ sap.ui.define([
|
|
|
285
244
|
* @private
|
|
286
245
|
*/
|
|
287
246
|
Utils.removeCBAndNormalizeUrl = function (sUrl) {
|
|
288
|
-
let aMatches;
|
|
289
247
|
let sUrlPrefix;
|
|
290
248
|
let sCacheBusterSegment;
|
|
291
249
|
let sUrlPostfix;
|
|
292
250
|
|
|
293
|
-
if (typeof sUrl !== "string" || sUrl === "" || isUriWithRelativeOrEmptyPath(sUrl)) {
|
|
294
|
-
return sUrl;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
251
|
function isUriWithRelativeOrEmptyPath (sUrl0) {
|
|
298
252
|
const oUri = new URI(sUrl0);
|
|
299
253
|
const sPath = oUri.path();
|
|
@@ -309,9 +263,13 @@ sap.ui.define([
|
|
|
309
263
|
return true;
|
|
310
264
|
}
|
|
311
265
|
|
|
266
|
+
if (typeof sUrl !== "string" || sUrl === "" || isUriWithRelativeOrEmptyPath(sUrl)) {
|
|
267
|
+
return sUrl;
|
|
268
|
+
}
|
|
269
|
+
|
|
312
270
|
// split up the URL into 3 parts: prefix, cache-buster segment, postfix
|
|
313
271
|
// leading slashes are always part of the segment, the postfix might have a trailing slash
|
|
314
|
-
aMatches = sUrl.match(/(.*)(\/~[\w-]+~[A-Z0-9]?)(.*)/);
|
|
272
|
+
const aMatches = sUrl.match(/(.*)(\/~[\w-]+~[A-Z0-9]?)(.*)/);
|
|
315
273
|
if (aMatches) {
|
|
316
274
|
sUrlPrefix = aMatches[1];
|
|
317
275
|
sCacheBusterSegment = aMatches[2];
|
|
@@ -384,11 +342,10 @@ sap.ui.define([
|
|
|
384
342
|
const oPatterns = oCacheBusting && oCacheBusting.patterns;
|
|
385
343
|
let sCacheBusterUrl = sUrl;
|
|
386
344
|
let aParameterMap = [];
|
|
387
|
-
let sSapUshellNoCb;
|
|
388
345
|
const aRules = [];
|
|
389
346
|
|
|
390
347
|
aParameterMap = Utils.getParameterMap();
|
|
391
|
-
sSapUshellNoCb = aParameterMap["sap-ushell-nocb"] && aParameterMap["sap-ushell-nocb"][0];
|
|
348
|
+
const sSapUshellNoCb = aParameterMap["sap-ushell-nocb"] && aParameterMap["sap-ushell-nocb"][0];
|
|
392
349
|
|
|
393
350
|
// When URL disables Cache Busting return URL without cache busting token
|
|
394
351
|
// It can happen that we get a URL which already has a cache-buster token included (from the ABAP server), so we also remove
|
|
@@ -517,10 +474,8 @@ sap.ui.define([
|
|
|
517
474
|
let sKey;
|
|
518
475
|
let sValue;
|
|
519
476
|
let iIndexOfEquals;
|
|
520
|
-
let aKeyValuePairs;
|
|
521
|
-
let aKeyValuePairsLength;
|
|
522
477
|
// Note: location.search starts with "?" if not empty
|
|
523
|
-
const sSearch = arguments.length > 0 ? sSearchString : location.search;
|
|
478
|
+
const sSearch = arguments.length > 0 ? sSearchString : window.location.search;
|
|
524
479
|
|
|
525
480
|
if (sSearch && sSearch.charAt(0) !== "?") {
|
|
526
481
|
throw new SrvcError(`Illegal search string ${sSearch}`);
|
|
@@ -532,8 +487,8 @@ sap.ui.define([
|
|
|
532
487
|
// Note: W3C recommends that servers support ";" as well as "&"
|
|
533
488
|
// (http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2)
|
|
534
489
|
// http://unixpapa.com/js/querystring.html advocates this on the client-side also!
|
|
535
|
-
aKeyValuePairs = sSearch.substring(1).replace(/\+/g, " ").split(/[&;]/);
|
|
536
|
-
aKeyValuePairsLength = aKeyValuePairs.length < 500 ? aKeyValuePairs.length : 500;
|
|
490
|
+
const aKeyValuePairs = sSearch.substring(1).replace(/\+/g, " ").split(/[&;]/);
|
|
491
|
+
const aKeyValuePairsLength = aKeyValuePairs.length < 500 ? aKeyValuePairs.length : 500;
|
|
537
492
|
|
|
538
493
|
for (i = 0, n = aKeyValuePairsLength; i < n; i += 1) {
|
|
539
494
|
// decode key/value pair at first "=" character
|
|
@@ -574,7 +529,6 @@ sap.ui.define([
|
|
|
574
529
|
*/
|
|
575
530
|
Utils.getParameterValue = function (sUrl, sName) {
|
|
576
531
|
let oParameterMap;
|
|
577
|
-
let iQueryIndex;
|
|
578
532
|
|
|
579
533
|
if (typeof sName !== "string") {
|
|
580
534
|
// avoid surprises when sName would later be converted into a string
|
|
@@ -582,7 +536,7 @@ sap.ui.define([
|
|
|
582
536
|
}
|
|
583
537
|
|
|
584
538
|
sUrl = sUrl.split("#")[0];
|
|
585
|
-
iQueryIndex = sUrl.indexOf("?");
|
|
539
|
+
const iQueryIndex = sUrl.indexOf("?");
|
|
586
540
|
if (iQueryIndex >= 0) {
|
|
587
541
|
oParameterMap = Utils.getParameterMap(sUrl.slice(iQueryIndex));
|
|
588
542
|
if (oParameterMap[sName]) {
|
|
@@ -630,11 +584,10 @@ sap.ui.define([
|
|
|
630
584
|
* @since 1.2.0
|
|
631
585
|
*/
|
|
632
586
|
Utils.parseXml = function (sXml) {
|
|
633
|
-
let oXml;
|
|
634
587
|
if (!sXml || typeof sXml !== "string") {
|
|
635
588
|
return null;
|
|
636
589
|
}
|
|
637
|
-
oXml = new DOMParser().parseFromString(sXml, "text/xml");
|
|
590
|
+
const oXml = new DOMParser().parseFromString(sXml, "text/xml");
|
|
638
591
|
if (oXml.getElementsByTagName("parsererror").length) { // Chrome, Firefox
|
|
639
592
|
throw new SrvcError(`Invalid XML: ${sXml}`);
|
|
640
593
|
}
|
|
@@ -211,12 +211,11 @@ sap.ui.define([
|
|
|
211
211
|
* @see chip.types.getAvailableTypes
|
|
212
212
|
*/
|
|
213
213
|
setType: function (sType) {
|
|
214
|
-
let sTypeLowerCase;
|
|
215
214
|
if (typeof sType !== "string" || sType === "") {
|
|
216
215
|
throw new SrvcError("The given type is not a string",
|
|
217
216
|
"contract.types");
|
|
218
217
|
}
|
|
219
|
-
sTypeLowerCase = sType.toLowerCase();
|
|
218
|
+
const sTypeLowerCase = sType.toLowerCase();
|
|
220
219
|
if (this.getAvailableTypes().indexOf(sTypeLowerCase) < 0) {
|
|
221
220
|
throw new SrvcError(`The CHIP does not support type '${sTypeLowerCase}'`,
|
|
222
221
|
"contract.types");
|
|
@@ -141,7 +141,7 @@ sap.ui.define([
|
|
|
141
141
|
* @name chip.writeConfiguration.setParameterValues
|
|
142
142
|
* @function
|
|
143
143
|
* @since 1.7.0
|
|
144
|
-
* @param {object<string,string>} mConfigurationUpdates
|
|
144
|
+
* @param {object<string, string>} mConfigurationUpdates
|
|
145
145
|
* The configuration updates. The values must be strings. You can however set a value to
|
|
146
146
|
* <code>undefined</code>. This removes it from the list of updated properties and effectively
|
|
147
147
|
* resets it to the default value.
|