@sapui5/sap.suite.ui.generic.template 1.84.16 → 1.84.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/sap/suite/ui/generic/template/.library +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/AddFilterItem.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/AddFooterActionButton.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/AddGroup.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/AddGroupElement.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/AddHeaderActionButton.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/AddHeaderFacet.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/AddSection.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/AddSubSection.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/AddTableColumn.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/AddToolbarActionButton.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/MoveFilterItems.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/MoveGroup.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/MoveGroupElement.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/MoveHeaderAndFooterActionButton.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/MoveHeaderFacet.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/MoveSection.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/MoveSubSection.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/MoveTableColumns.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/MoveToolbarActionButtons.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/RemoveFilterItem.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/RemoveGroup.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/RemoveGroupElement.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/RemoveHeaderAndFooterActionButton.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/RemoveHeaderFacet.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/RemoveSection.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/RemoveSubSection.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/RemoveTableColumn.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/RemoveToolbarActionButton.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/RevealFilterItem.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/RevealHeaderFacet.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/RevealTableColumn.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/RevealToolbarActionButton.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/generic/AddElement.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/generic/MoveElements.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/generic/RemoveElement.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/generic/RevealElement.js +1 -1
- package/src/sap/suite/ui/generic/template/changeHandler/util/AnnotationPropertyCommand.js +1 -1
- package/src/sap/suite/ui/generic/template/lib/navigation/NavigationController.js +5 -4
- package/src/sap/suite/ui/generic/template/lib/navigation/jsonHelper.js +190 -0
- package/src/sap/suite/ui/generic/template/library.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sapui5/sap.suite.ui.generic.template",
|
|
3
|
-
"version": "1.84.
|
|
3
|
+
"version": "1.84.19",
|
|
4
4
|
"description": "SAPUI5 Library sap.suite.ui.generic.template",
|
|
5
5
|
"homepage": "https://sap.github.io/ui5-tooling/pages/SAPUI5/",
|
|
6
6
|
"author": "SAP SE (https://www.sap.com)",
|
|
@@ -64,6 +64,7 @@ sap.ui.define(["sap/ui/base/Object",
|
|
|
64
64
|
"sap/suite/ui/generic/template/lib/CRUDHelper",
|
|
65
65
|
"sap/suite/ui/generic/template/lib/ProcessObserver",
|
|
66
66
|
"sap/suite/ui/generic/template/lib/Queue",
|
|
67
|
+
"sap/suite/ui/generic/template/lib/navigation/jsonHelper",
|
|
67
68
|
"sap/suite/ui/generic/template/lib/navigation/routingHelper",
|
|
68
69
|
"sap/suite/ui/generic/template/lib/TemplateComponent",
|
|
69
70
|
"sap/suite/ui/generic/template/lib/testableHelper",
|
|
@@ -74,7 +75,7 @@ sap.ui.define(["sap/ui/base/Object",
|
|
|
74
75
|
"sap/base/util/isEmptyObject",
|
|
75
76
|
"sap/base/util/UriParameters",
|
|
76
77
|
"sap/suite/ui/generic/template/lib/FeError"
|
|
77
|
-
], function(BaseObject, ComponentContainer, HashChanger, History, coreLibrary, CRUDHelper, ProcessObserver, Queue, routingHelper,
|
|
78
|
+
], function(BaseObject, ComponentContainer, HashChanger, History, coreLibrary, CRUDHelper, ProcessObserver, Queue, jsonHelper, routingHelper,
|
|
78
79
|
TemplateComponent, testableHelper, ControlPersonalizationAPI, FeLogger, merge, extend, isEmptyObject, UriParameters, FeError) {
|
|
79
80
|
"use strict";
|
|
80
81
|
var sClassName = "lib.navigation.NavigationController";
|
|
@@ -1246,7 +1247,7 @@ sap.ui.define(["sap/ui/base/Object",
|
|
|
1246
1247
|
var sPredefinedKey;
|
|
1247
1248
|
if (vPredefinedValues){
|
|
1248
1249
|
var oAppState = oCrossAppNavigator.createEmptyAppState(oTemplateContract.oAppComponent);
|
|
1249
|
-
oAppState.setData(vPredefinedValues);
|
|
1250
|
+
oAppState.setData(jsonHelper.getStringifiable(vPredefinedValues));
|
|
1250
1251
|
oAppState.save();
|
|
1251
1252
|
sPredefinedKey = oAppState.getKey();
|
|
1252
1253
|
}
|
|
@@ -1779,7 +1780,7 @@ sap.ui.define(["sap/ui/base/Object",
|
|
|
1779
1780
|
return oPredefinedValuesPromise.then(function(oAppStateData){
|
|
1780
1781
|
oRegistryEntry.nonDraftCreateContext = oPredefinedCreateContext ||
|
|
1781
1782
|
oRegistryEntry.nonDraftCreateContext ||
|
|
1782
|
-
CRUDHelper.createNonDraft(oParentContext, sBindingPath, oModel, oAppStateData && oAppStateData.getData(), oTemplateContract.oApplicationProxy.mustRequireRequestsCanonical());
|
|
1783
|
+
CRUDHelper.createNonDraft(oParentContext, sBindingPath, oModel, oAppStateData && jsonHelper.deStringify(oAppStateData.getData()), oTemplateContract.oApplicationProxy.mustRequireRequestsCanonical());
|
|
1783
1784
|
oPredefinedCreateContext = null;
|
|
1784
1785
|
return fnPerformActivation(oRegistryEntry.nonDraftCreateContext.getPath());
|
|
1785
1786
|
});
|
|
@@ -2351,7 +2352,7 @@ sap.ui.define(["sap/ui/base/Object",
|
|
|
2351
2352
|
* @param {sap.suite.ui.generic.template.lib.AppComponent} oAppComponent The AppComponent instance
|
|
2352
2353
|
* @public
|
|
2353
2354
|
* @extends sap.ui.base.Object
|
|
2354
|
-
* @version 1.84.
|
|
2355
|
+
* @version 1.84.19
|
|
2355
2356
|
* @since 1.30.0
|
|
2356
2357
|
* @alias sap.suite.ui.generic.template.lib.NavigationController
|
|
2357
2358
|
*/
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
sap.ui.define([], function() {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var sVersionPropertyName = "sap.suite.ui.generic.template.genericUtils.jsonHelper.versionInfo";
|
|
5
|
+
|
|
6
|
+
// Helper function for getStringifiable which adds replacement infos for a subtree
|
|
7
|
+
// vObject is a nested subobject of the original object and aPath is the property path that has taken us to vObject
|
|
8
|
+
// aReplaces is the array which accumulates the replace operations
|
|
9
|
+
function fnAccumulateReplaceInfo(vObject, aReplaces, aPath){
|
|
10
|
+
// Following cases need to be considered:
|
|
11
|
+
// 1. vObject is undefined -> create a replacement for undefined and we are done
|
|
12
|
+
// 2. vObject is an instance of Date -> create a replacement for the Date and we are done
|
|
13
|
+
// 3. vObject is any other object -> recursively check the properties of vObject for replacements
|
|
14
|
+
// 4. vObject is neither an object nor undefined -> vObject does not create any need for replacements
|
|
15
|
+
if (typeof vObject !== "object"){ // case 1 or 4
|
|
16
|
+
if (vObject === undefined){ // case 1
|
|
17
|
+
aReplaces.push({
|
|
18
|
+
type: "undefined",
|
|
19
|
+
path: aPath
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (vObject instanceof Date){ // case 2
|
|
25
|
+
var oReplacement = {
|
|
26
|
+
type: "Date",
|
|
27
|
+
milliseconds: vObject.getTime(),
|
|
28
|
+
path: aPath
|
|
29
|
+
};
|
|
30
|
+
// Edge case: Even instances of Date may have properties. These will not be serialized by JSON.stringify.
|
|
31
|
+
// -> In order to be able to restore the properties of vObject they need to be stored within oReplacement, too.
|
|
32
|
+
// This is done by adding the representation provided by getStringifiable(), since this can be restored most easily.
|
|
33
|
+
// Thus a map: <property name> -> getStringifiable(<property value>) is created and added to oReplacement (in case it is not empty) as property 'childProps'.
|
|
34
|
+
var oChildProps = Object.create(null);
|
|
35
|
+
for (var sProperty in vObject){
|
|
36
|
+
oChildProps[sProperty] = getStringifiable(vObject[sProperty]);
|
|
37
|
+
oReplacement.childProps = oChildProps; // Note that this is only effective when being called the first time
|
|
38
|
+
}
|
|
39
|
+
aReplaces.push(oReplacement);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// case 3
|
|
43
|
+
for (var sProperty in vObject){
|
|
44
|
+
var vPart = vObject[sProperty];
|
|
45
|
+
var aPathToProperty = aPath.concat(sProperty);
|
|
46
|
+
fnAccumulateReplaceInfo(vPart, aReplaces, aPathToProperty);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/*
|
|
51
|
+
* This function is intended to work together with function fnDeStringify (see below).
|
|
52
|
+
* The usage of these two functions allow to serialize/deserialize java script object containing instances of Date and undefined values without data loss.
|
|
53
|
+
* To achieve this goal the functions should be used together with the standard serialization/deseriazation methods JSON.stringify/parse.
|
|
54
|
+
* Note that when using those standard functions there might be a data loss if the object to be serialized contains instances of Date or properties which have value undefined.
|
|
55
|
+
* In order to achieve this the following mimic should be used:
|
|
56
|
+
* Before serializing a given java script object vObject1 pass it to this function.
|
|
57
|
+
* The returned value will be an object vObject2 which might be identical to vObject1 or have a pointer to vObject1 (so do not modify vObject1 or one of its components before the next step).
|
|
58
|
+
* Now serialize vObject2 via JSON.stringify or any other service which internally uses a logic similar to JSON.stringify.
|
|
59
|
+
* When you want to obtain again a deserialized version of your object, take the serialized version you have received and deserialize it with JSON.parse resp. any other service which inverts the serialization applied beforehand.
|
|
60
|
+
* This will provide another javascript object vObject3.
|
|
61
|
+
* Pass vObject3 to fnDeStringify and receive another object vObject4.
|
|
62
|
+
* vObject4 will be a cloned version of vObject1.
|
|
63
|
+
* The following remarks apply:
|
|
64
|
+
* - Any other restriction of the serialization/deserialization process implemented by JSON.stringify/parse still apply. In particular function objects will get lost by this process and trying to serialize a circular structure may fail.
|
|
65
|
+
* - In order to be as robust as possible against a process which has missed to apply the getStringifiable function on the object to be serialized (meaning vObject2 will be taken as vObject1 in the description above) the following additional rules apply:
|
|
66
|
+
* # vObject2 will only differ from vObject1 if it contains (possibly nested) an object of type Date or an undefined value or it mimics to be a result of getStringifiable itself.
|
|
67
|
+
* # fnDeStringify will handle all kinds of objects. If the object passed to it cannot be identified as being a result of a process as described above it will simply return the instance passed to it
|
|
68
|
+
* - The last step may perform changes on vObject3. vObject4 might be identical to vObject3 or have a reference to one of its components. Therefore, it is recommended to skip any reference to vObject3 after vObject4 has been obtained.
|
|
69
|
+
*/
|
|
70
|
+
function getStringifiable(vObject){
|
|
71
|
+
if (vObject !== undefined && (!vObject || typeof vObject !== "object")){ // in all these cases JSON.stringify/parse does the job
|
|
72
|
+
return vObject;
|
|
73
|
+
}
|
|
74
|
+
// In aReplaces we accumulate all necessary replacement operations that need to be applied in fnDeStringify.
|
|
75
|
+
// Each entry contains properties:
|
|
76
|
+
// - type: describes the type of replacement to be done (current values are 'Date' and 'undefined')
|
|
77
|
+
// - path: an array of strings that describes how to step down to the property where the replacement needs to be done
|
|
78
|
+
// - additional properties might be used depending on the replacement type
|
|
79
|
+
var aReplaces = [];
|
|
80
|
+
fnAccumulateReplaceInfo(vObject, aReplaces, []);
|
|
81
|
+
if (aReplaces.length === 0 && !vObject[sVersionPropertyName]){ // if no replacement is necessary the current object could still be an object that mimics to be a result of getStringifiable itself. Otherwise we can use the object itself.
|
|
82
|
+
return vObject;
|
|
83
|
+
}
|
|
84
|
+
var oRet = { // If a replacement is necessary we put together the object itself and the replacement information
|
|
85
|
+
data: vObject,
|
|
86
|
+
replaces: aReplaces
|
|
87
|
+
};
|
|
88
|
+
oRet[sVersionPropertyName] = 1; // mark oRet as an object that is created by getStringifiable
|
|
89
|
+
return oRet;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// See documentation of getStringifiable
|
|
93
|
+
function fnDeStringify(vObject){
|
|
94
|
+
if (!vObject || typeof vObject !== "object" || vObject[sVersionPropertyName] !== 1 || !Array.isArray(vObject.replaces)){
|
|
95
|
+
return vObject; // in these cases either vObject is not a result of getStringifiable() or it is an object for which getStringifiable() acts as identity function
|
|
96
|
+
}
|
|
97
|
+
var aReplacers = []; // build an array of functions that execute the necessary replacements on vObject
|
|
98
|
+
var oRootReplacement; // The replacement for vObject itself (if it exists)
|
|
99
|
+
var bError = vObject.replaces.some(function(oReplaceInfo){ // bError will be true if any memeber of vObject.replaces proves that vObject is not "a valid vObject3" (see above)
|
|
100
|
+
if (typeof oReplaceInfo !== "object" || !Array.isArray(oReplaceInfo.path)){
|
|
101
|
+
return true; // oReplaceInfo is not a valid replacement description
|
|
102
|
+
}
|
|
103
|
+
if (oReplaceInfo.path.length === 0){ // oReplaceInfo defines a replacement for vObject itself -> vObject either represents undefined or a Date
|
|
104
|
+
oRootReplacement = oReplaceInfo;
|
|
105
|
+
return vObject.replaces.length > 1; // if vObject is either udefined or a Date there should be no other replacement info
|
|
106
|
+
}
|
|
107
|
+
var fnReplacer; // a function that executes the replacements defined by oReplaceInfo
|
|
108
|
+
var vCurrent = vObject.data; // current position in vObject-data while navigating according to the path specified by oReplaceInfo.path
|
|
109
|
+
var bRet = oReplaceInfo.path.some(function(sProp, i){ // navigate down in vObject.data. bRet will indicate whether something was found that indicates the oReplaceInfo is not valid
|
|
110
|
+
if (typeof vCurrent !== "object" || typeof sProp !== "string"){ // vCurrent should be an object that possesses a property with name sProp
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
if (i === oReplaceInfo.path.length - 1){ // do not step down the last step in hierarchy, since we want to do a replacement for that property
|
|
114
|
+
switch (oReplaceInfo.type){
|
|
115
|
+
case "undefined":
|
|
116
|
+
if (vCurrent.hasOwnProperty(sProp)){ // oReplaceInfo states that this property has value undefined -> JSON.stringify will have ignored it
|
|
117
|
+
return true; // In case the property is there anyway oReplaceInfo cannot be valid (for vObject.data)
|
|
118
|
+
}
|
|
119
|
+
// looks ok -> Create a function that sets the property to undefined in vCurrent
|
|
120
|
+
fnReplacer = function(){
|
|
121
|
+
vCurrent[sProp] = undefined;
|
|
122
|
+
};
|
|
123
|
+
return false;
|
|
124
|
+
case "Date":
|
|
125
|
+
if (Number.isInteger(oReplaceInfo.milliseconds)){ // Check whether oReplaceInfo is really a replacement info for a Date
|
|
126
|
+
var dReplace = new Date(oReplaceInfo.milliseconds); // This is the Date which should be put at vCurrent[sProp]
|
|
127
|
+
if (JSON.stringify(dReplace) !== '"' + vCurrent[sProp] + '"'){
|
|
128
|
+
return true; // dReplace and the current value do not fit to each other
|
|
129
|
+
}
|
|
130
|
+
if (oReplaceInfo.childProps && typeof oReplaceInfo.childProps !== "object"){
|
|
131
|
+
return true; // The childProps property is there but does not have the expected structure
|
|
132
|
+
}
|
|
133
|
+
fnReplacer = function(){
|
|
134
|
+
if (oReplaceInfo.childProps){
|
|
135
|
+
for (var sChildProp in oReplaceInfo.childProps){
|
|
136
|
+
dReplace[sChildProp] = fnDeStringify(oReplaceInfo.childProps[sChildProp]);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
vCurrent[sProp] = dReplace;
|
|
140
|
+
};
|
|
141
|
+
return false; // everything looks fine -> a replacer implementing the defined replacement could be created
|
|
142
|
+
}
|
|
143
|
+
return true; // oReplaceInfo cannot be a valid replacement for a Date
|
|
144
|
+
default: return true; // unknown type of ReplacementInfo
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
// in any othe step then the last just move down the hierarchy
|
|
148
|
+
vCurrent = vCurrent[sProp];
|
|
149
|
+
});
|
|
150
|
+
aReplacers.push(fnReplacer); // add the created replacer function to the list (might be undefined if bRet is true, but then it will be ignored anyway)
|
|
151
|
+
return bRet;
|
|
152
|
+
});
|
|
153
|
+
if (bError){ // if vObject is not valid for vObject3, return it unchanged according to the contract
|
|
154
|
+
return vObject;
|
|
155
|
+
}
|
|
156
|
+
if (oRootReplacement){ // there is just one replacement info and that applies to the root itself -> The instance to be created is either undefined or a Date
|
|
157
|
+
if (oRootReplacement.type === "undefined"){
|
|
158
|
+
return undefined;
|
|
159
|
+
} else if (oRootReplacement.type === "Date" && Number.isInteger(oRootReplacement.milliseconds)){
|
|
160
|
+
var dRet = new Date(oRootReplacement.milliseconds); // the Date object to be returned
|
|
161
|
+
if (JSON.stringify(dRet) === '"' + vObject.data + '"'){ // If dRet is consistent with the string representation expected in vObject.data
|
|
162
|
+
if (oRootReplacement.childProps){ // if there are child properties to be added
|
|
163
|
+
if (typeof oRootReplacement.childProps !== "object"){ // that would not be a valid childProps -> oRootReplacement would not be valid
|
|
164
|
+
return vObject;
|
|
165
|
+
}
|
|
166
|
+
// add the properties to dRet as defined in oRootReplacement.childProps
|
|
167
|
+
for (var sChildProp in oRootReplacement.childProps){
|
|
168
|
+
dRet[sChildProp] = fnDeStringify(oRootReplacement.childProps[sChildProp]);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return dRet; // return the Date which was created as decribed in oRootReplacement
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return vObject; // oRootReplacement is not a valid replacement
|
|
175
|
+
}
|
|
176
|
+
// vObject.data is the right object, but it needs to be adjusted by calling the collected replacers
|
|
177
|
+
aReplacers.forEach(function(fnReplace){
|
|
178
|
+
fnReplace();
|
|
179
|
+
});
|
|
180
|
+
// return the adjusted instance
|
|
181
|
+
return vObject.data;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
var oJsonHelper = {
|
|
185
|
+
getStringifiable: getStringifiable,
|
|
186
|
+
deStringify: fnDeStringify
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
return oJsonHelper;
|
|
190
|
+
});
|