@sapui5/sap.fe.navigation 1.102.2 → 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 +3 -4
- package/src/sap/fe/navigation/.library +1 -1
- package/src/sap/fe/navigation/NavError.js +4 -4
- package/src/sap/fe/navigation/NavigationHandler.js +381 -287
- package/src/sap/fe/navigation/PresentationVariant.js +321 -316
- package/src/sap/fe/navigation/SelectionVariant.js +26 -6
- package/src/sap/fe/navigation/library.js +19 -2
|
@@ -3,345 +3,350 @@
|
|
|
3
3
|
(c) Copyright 2009-2021 SAP SE. All rights reserved
|
|
4
4
|
|
|
5
5
|
*/
|
|
6
|
-
sap.ui.define(
|
|
7
|
-
NavError,
|
|
8
|
-
BaseObject,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
6
|
+
sap.ui.define(
|
|
7
|
+
["./NavError", "sap/ui/base/Object", "sap/base/util/extend", "sap/base/util/each", "sap/base/Log"],
|
|
8
|
+
function (NavError, BaseObject, extend, each, Log) {
|
|
9
|
+
"use strict";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @class
|
|
13
|
+
* This is the successor of {@link sap.ui.generic.app.navigation.service.PresentationVariant}.<br>
|
|
14
|
+
* Creates a new instance of a PresentationVariant class. If no parameter is passed,
|
|
15
|
+
* an new empty instance is created whose ID has been set to <code>""</code>.
|
|
16
|
+
* Passing a JSON-serialized string complying to the Selection Variant Specification will parse it,
|
|
17
|
+
* and the newly created instance will contain the same information.
|
|
18
|
+
* @extends sap.ui.base.Object
|
|
19
|
+
* @class
|
|
20
|
+
* @public
|
|
21
|
+
* @since 1.83.0
|
|
22
|
+
* @name sap.fe.navigation.PresentationVariant
|
|
23
|
+
* @param {string|object} [vPresentationVariant] If of type <code>string</code>, the selection variant is JSON-formatted;
|
|
24
|
+
* if of type <code>object</code>, the object represents a selection variant
|
|
25
|
+
* @throws An instance of {@link sap.fe.navigation.NavError} in case of input errors. Valid error codes are:
|
|
26
|
+
* <table>
|
|
27
|
+
* <tr><th>NavError code</th><th>Description</th></tr>
|
|
28
|
+
* <tr><td>PresentationVariant.INVALID_INPUT_TYPE</td><td>Indicates that the data format of the selection variant provided is inconsistent</td></tr>
|
|
29
|
+
* <tr><td>PresentationVariant.UNABLE_TO_PARSE_INPUT</td><td>Indicates that the provided string is not a JSON-formatted string</td></tr>
|
|
30
|
+
* <tr><td>PresentationVariant.INPUT_DOES_NOT_CONTAIN_SELECTIONVARIANT_ID</td><td>Indicates that the PresentationVariantID cannot be retrieved</td></tr>
|
|
31
|
+
* <tr><td>PresentationVariant.PARAMETER_WITHOUT_VALUE</td><td>Indicates that there was an attempt to specify a parameter, but without providing any value (not even an empty value)</td></tr>
|
|
32
|
+
* <tr><td>PresentationVariant.SELECT_OPTION_WITHOUT_PROPERTY_NAME</td><td>Indicates that a selection option has been defined, but the Ranges definition is missing</td></tr>
|
|
33
|
+
* <tr><td>PresentationVariant.SELECT_OPTION_RANGES_NOT_ARRAY</td><td>Indicates that the Ranges definition is not an array</td></tr>
|
|
34
|
+
* </table>
|
|
35
|
+
* These exceptions can only be thrown if the parameter <code>vPresentationVariant</code> has been provided.
|
|
36
|
+
*/
|
|
37
|
+
return BaseObject.extend(
|
|
38
|
+
"sap.fe.navigation.PresentationVariant",
|
|
39
|
+
/** @lends sap.fe.navigation.PresentationVariant.prototype */ {
|
|
40
|
+
constructor: function (vPresentationVariant) {
|
|
41
|
+
this._sId = "";
|
|
42
|
+
|
|
43
|
+
if (vPresentationVariant !== undefined) {
|
|
44
|
+
if (typeof vPresentationVariant === "string") {
|
|
45
|
+
this._parseFromString(vPresentationVariant);
|
|
46
|
+
} else if (typeof vPresentationVariant === "object") {
|
|
47
|
+
this._parseFromObject(vPresentationVariant);
|
|
48
|
+
} else {
|
|
49
|
+
throw new NavError("PresentationVariant.INVALID_INPUT_TYPE");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Returns the identification of the selection variant.
|
|
56
|
+
*
|
|
57
|
+
* @returns {string} The identification of the selection variant as made available during construction
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
getID: function () {
|
|
61
|
+
return this._sId;
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Sets the identification of the selection variant.
|
|
66
|
+
*
|
|
67
|
+
* @param {string} sId The new identification of the selection variant
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
setID: function (sId) {
|
|
71
|
+
this._sId = sId;
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Sets the text / description of the selection variant.
|
|
76
|
+
*
|
|
77
|
+
* @param {string} sNewText The new description to be used
|
|
78
|
+
* @public
|
|
79
|
+
* @throws An instance of {@link sap.fe.navigation.NavError} in case of input errors. Valid error codes are:
|
|
80
|
+
* <table>
|
|
81
|
+
* <tr><th>NavError code</th><th>Description</th></tr>
|
|
82
|
+
* <tr><td>PresentationVariant.INVALID_INPUT_TYPE</td><td>Indicates that an input parameter has an invalid type</td></tr>
|
|
83
|
+
* </table>
|
|
84
|
+
*/
|
|
85
|
+
setText: function (sNewText) {
|
|
86
|
+
if (typeof sNewText !== "string") {
|
|
53
87
|
throw new NavError("PresentationVariant.INVALID_INPUT_TYPE");
|
|
54
88
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Gets the chart visualization property.
|
|
193
|
-
*
|
|
194
|
-
* @returns {map} An object containing the properties to be used for the chart visualization.
|
|
195
|
-
* @public
|
|
196
|
-
*/
|
|
197
|
-
getChartVisualization: function() {
|
|
198
|
-
return this._mVisChart;
|
|
199
|
-
},
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Returns the external representation of the selection variant as JSON object.
|
|
203
|
-
* @returns {object} The external representation of this instance as a JSON object
|
|
204
|
-
* @public
|
|
205
|
-
*/
|
|
206
|
-
toJSONObject: function() {
|
|
207
|
-
var oExternalPresentationVariant = {
|
|
208
|
-
Version: {
|
|
209
|
-
// Version attributes are not part of the official specification,
|
|
210
|
-
Major: "1", // but could be helpful later for implementing a proper lifecycle/interoperability
|
|
211
|
-
Minor: "0",
|
|
212
|
-
Patch: "0"
|
|
213
|
-
},
|
|
214
|
-
PresentationVariantID: this._sId
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
if (this._sCtxUrl) {
|
|
218
|
-
oExternalPresentationVariant.ContextUrl = this._sCtxUrl;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
if (this._sText) {
|
|
222
|
-
oExternalPresentationVariant.Text = this._sText;
|
|
223
|
-
} else {
|
|
224
|
-
oExternalPresentationVariant.Text = "Presentation Variant with ID " + this._sId;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
this._serializeProperties(oExternalPresentationVariant);
|
|
228
|
-
this._serializeVisualizations(oExternalPresentationVariant);
|
|
229
|
-
|
|
230
|
-
return oExternalPresentationVariant;
|
|
231
|
-
},
|
|
89
|
+
this._sText = sNewText;
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Returns the current text / description of this selection variant.
|
|
94
|
+
*
|
|
95
|
+
* @returns {string} The current description of this selection variant.
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
|
+
getText: function () {
|
|
99
|
+
return this._sText;
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Sets the context URL.
|
|
104
|
+
*
|
|
105
|
+
* @param {string} sURL The URL of the context
|
|
106
|
+
* @public
|
|
107
|
+
* @throws An instance of {@link sap.fe.navigation.NavError} in case of input errors. Valid error codes are:
|
|
108
|
+
* <table>
|
|
109
|
+
* <tr><th>NavError code</th><th>Description</th></tr>
|
|
110
|
+
* <tr><td>PresentationVariant.INVALID_INPUT_TYPE</td><td>Indicates that an input parameter has an invalid type</td></tr>
|
|
111
|
+
* </table>
|
|
112
|
+
*/
|
|
113
|
+
setContextUrl: function (sURL) {
|
|
114
|
+
if (typeof sURL !== "string") {
|
|
115
|
+
throw new NavError("PresentationVariant.INVALID_INPUT_TYPE");
|
|
116
|
+
}
|
|
117
|
+
this._sCtxUrl = sURL;
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Gets the current context URL intended for the query.
|
|
122
|
+
*
|
|
123
|
+
* @returns {string} The current context URL for the query
|
|
124
|
+
* @public
|
|
125
|
+
*/
|
|
126
|
+
getContextUrl: function () {
|
|
127
|
+
return this._sCtxUrl;
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Returns <code>true</code> if the presentation variant does not contain any properties.
|
|
132
|
+
* nor ranges.
|
|
133
|
+
*
|
|
134
|
+
* @returns {boolean} If set to <code>true</code> there are no current properties set; <code>false</code> otherwise.
|
|
135
|
+
* @public
|
|
136
|
+
*/
|
|
137
|
+
isEmpty: function () {
|
|
138
|
+
return (
|
|
139
|
+
Object.keys(this.getTableVisualization()).length === 0 &&
|
|
140
|
+
Object.keys(this.getChartVisualization()).length === 0 &&
|
|
141
|
+
Object.keys(this.getProperties()).length === 0
|
|
142
|
+
);
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Sets the more trivial properties. Basically all properties with the exception of the Visualization.
|
|
147
|
+
*
|
|
148
|
+
* @param {any} mProperties The properties to be used.
|
|
149
|
+
* @public
|
|
150
|
+
*/
|
|
151
|
+
setProperties: function (mProperties) {
|
|
152
|
+
this._mProperties = extend({}, mProperties);
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Gets the more trivial properties. Basically all properties with the exception of the Visualization.
|
|
157
|
+
*
|
|
158
|
+
* @returns {any} The current properties.
|
|
159
|
+
* @public
|
|
160
|
+
*/
|
|
161
|
+
getProperties: function () {
|
|
162
|
+
return this._mProperties;
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Sets the table visualization property.
|
|
167
|
+
*
|
|
168
|
+
* @param {any} mProperties An object containing the properties to be used for the table visualization.
|
|
169
|
+
* @public
|
|
170
|
+
*/
|
|
171
|
+
setTableVisualization: function (mProperties) {
|
|
172
|
+
this._mVisTable = extend({}, mProperties);
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Gets the table visualization property.
|
|
177
|
+
*
|
|
178
|
+
* @returns {any} An object containing the properties to be used for the table visualization.
|
|
179
|
+
* @public
|
|
180
|
+
*/
|
|
181
|
+
getTableVisualization: function () {
|
|
182
|
+
return this._mVisTable;
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Sets the chart visualization property.
|
|
187
|
+
*
|
|
188
|
+
* @param {any} mProperties An object containing the properties to be used for the chart visualization.
|
|
189
|
+
* @public
|
|
190
|
+
*/
|
|
191
|
+
setChartVisualization: function (mProperties) {
|
|
192
|
+
this._mVisChart = extend({}, mProperties);
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Gets the chart visualization property.
|
|
197
|
+
*
|
|
198
|
+
* @returns {any} An object containing the properties to be used for the chart visualization.
|
|
199
|
+
* @public
|
|
200
|
+
*/
|
|
201
|
+
getChartVisualization: function () {
|
|
202
|
+
return this._mVisChart;
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Returns the external representation of the selection variant as JSON object.
|
|
207
|
+
*
|
|
208
|
+
* @returns {object} The external representation of this instance as a JSON object
|
|
209
|
+
* @public
|
|
210
|
+
*/
|
|
211
|
+
toJSONObject: function () {
|
|
212
|
+
var oExternalPresentationVariant = {
|
|
213
|
+
Version: {
|
|
214
|
+
// Version attributes are not part of the official specification,
|
|
215
|
+
Major: "1", // but could be helpful later for implementing a proper lifecycle/interoperability
|
|
216
|
+
Minor: "0",
|
|
217
|
+
Patch: "0"
|
|
218
|
+
},
|
|
219
|
+
PresentationVariantID: this._sId
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
if (this._sCtxUrl) {
|
|
223
|
+
oExternalPresentationVariant.ContextUrl = this._sCtxUrl;
|
|
224
|
+
}
|
|
232
225
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
toJSONString: function() {
|
|
239
|
-
return JSON.stringify(this.toJSONObject());
|
|
240
|
-
},
|
|
226
|
+
if (this._sText) {
|
|
227
|
+
oExternalPresentationVariant.Text = this._sText;
|
|
228
|
+
} else {
|
|
229
|
+
oExternalPresentationVariant.Text = "Presentation Variant with ID " + this._sId;
|
|
230
|
+
}
|
|
241
231
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
232
|
+
this._serializeProperties(oExternalPresentationVariant);
|
|
233
|
+
this._serializeVisualizations(oExternalPresentationVariant);
|
|
234
|
+
|
|
235
|
+
return oExternalPresentationVariant;
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Serializes this instance into a JSON-formatted string.
|
|
240
|
+
*
|
|
241
|
+
* @returns {string} The JSON-formatted representation of this instance in stringified format
|
|
242
|
+
* @public
|
|
243
|
+
*/
|
|
244
|
+
toJSONString: function () {
|
|
245
|
+
return JSON.stringify(this.toJSONObject());
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
_serializeProperties: function (oExternalPresentationVariant) {
|
|
249
|
+
if (!this.getProperties()) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
246
252
|
|
|
247
|
-
|
|
248
|
-
|
|
253
|
+
extend(oExternalPresentationVariant, this.getProperties());
|
|
254
|
+
},
|
|
249
255
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
256
|
+
_serializeVisualizations: function (oExternalPresentationVariant) {
|
|
257
|
+
if (this.getTableVisualization()) {
|
|
258
|
+
if (!oExternalPresentationVariant.Visualizations) {
|
|
259
|
+
oExternalPresentationVariant.Visualizations = [];
|
|
260
|
+
}
|
|
261
|
+
oExternalPresentationVariant.Visualizations.push(this.getTableVisualization());
|
|
254
262
|
}
|
|
255
|
-
oExternalPresentationVariant.Visualizations.push(this.getTableVisualization());
|
|
256
|
-
}
|
|
257
263
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
264
|
+
if (this.getChartVisualization()) {
|
|
265
|
+
if (!oExternalPresentationVariant.Visualizations) {
|
|
266
|
+
oExternalPresentationVariant.Visualizations = [];
|
|
267
|
+
}
|
|
268
|
+
oExternalPresentationVariant.Visualizations.push(this.getChartVisualization());
|
|
261
269
|
}
|
|
262
|
-
|
|
263
|
-
}
|
|
264
|
-
},
|
|
270
|
+
},
|
|
265
271
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
272
|
+
_parseFromString: function (sJSONString) {
|
|
273
|
+
if (sJSONString === undefined) {
|
|
274
|
+
throw new NavError("PresentationVariant.UNABLE_TO_PARSE_INPUT");
|
|
275
|
+
}
|
|
270
276
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
277
|
+
if (typeof sJSONString !== "string") {
|
|
278
|
+
throw new NavError("PresentationVariant.INVALID_INPUT_TYPE");
|
|
279
|
+
}
|
|
274
280
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
281
|
+
var oInput = JSON.parse(sJSONString);
|
|
282
|
+
// the input needs to be an JSON string by specification
|
|
283
|
+
|
|
284
|
+
this._parseFromObject(oInput);
|
|
285
|
+
},
|
|
286
|
+
|
|
287
|
+
_parseFromObject: function (oInput) {
|
|
288
|
+
if (oInput.PresentationVariantID === undefined) {
|
|
289
|
+
// Do not throw an error, but only write a warning into the log.
|
|
290
|
+
// The PresentationVariantID is mandatory according to the specification document version 1.0,
|
|
291
|
+
// but this document is not a universally valid standard.
|
|
292
|
+
// It is said that the "implementation of the SmartFilterBar" may supersede the specification.
|
|
293
|
+
// Thus, also allow an initial PresentationVariantID.
|
|
294
|
+
// throw new sap.fe.navigation.NavError("PresentationVariant.INPUT_DOES_NOT_CONTAIN_SELECTIONVARIANT_ID");
|
|
295
|
+
Log.warning("PresentationVariantID is not defined");
|
|
296
|
+
oInput.PresentationVariantID = "";
|
|
297
|
+
}
|
|
292
298
|
|
|
293
|
-
|
|
294
|
-
|
|
299
|
+
var oInputCopy = extend({}, oInput);
|
|
300
|
+
delete oInputCopy.Version;
|
|
295
301
|
|
|
296
|
-
|
|
297
|
-
|
|
302
|
+
this.setID(oInput.PresentationVariantID);
|
|
303
|
+
delete oInputCopy.PresentationVariantID;
|
|
298
304
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
305
|
+
if (oInput.ContextUrl !== undefined && oInput.ContextUrl !== "") {
|
|
306
|
+
this.setContextUrl(oInput.ContextUrl);
|
|
307
|
+
delete oInputCopy.ContextUrl;
|
|
308
|
+
}
|
|
303
309
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
310
|
+
if (oInput.Text !== undefined) {
|
|
311
|
+
this.setText(oInput.Text);
|
|
312
|
+
delete oInputCopy.Text;
|
|
313
|
+
}
|
|
308
314
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
315
|
+
if (oInput.Visualizations) {
|
|
316
|
+
this._parseVisualizations(oInput.Visualizations);
|
|
317
|
+
delete oInputCopy.Visualizations;
|
|
318
|
+
}
|
|
313
319
|
|
|
314
|
-
|
|
315
|
-
|
|
320
|
+
this._parseProperties(oInputCopy);
|
|
321
|
+
},
|
|
316
322
|
|
|
317
|
-
|
|
318
|
-
|
|
323
|
+
_parseProperties: function (oInput) {
|
|
324
|
+
var mProperties = {};
|
|
319
325
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
326
|
+
each(oInput, function (sKey, vValue) {
|
|
327
|
+
mProperties[sKey] = vValue;
|
|
328
|
+
});
|
|
323
329
|
|
|
324
|
-
|
|
325
|
-
|
|
330
|
+
this.setProperties(mProperties);
|
|
331
|
+
},
|
|
326
332
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
333
|
+
_parseVisualizations: function (aVisualizations) {
|
|
334
|
+
if (!Array.isArray(aVisualizations)) {
|
|
335
|
+
throw new NavError("PresentationVariant.INVALID_INPUT_TYPE");
|
|
336
|
+
}
|
|
337
|
+
if (typeof aVisualizations.length > 2) {
|
|
338
|
+
throw new NavError("PresentationVariant.TOO_MANY_VISUALIZATIONS");
|
|
339
|
+
}
|
|
334
340
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
341
|
+
for (var i = 0; i < aVisualizations.length; i++) {
|
|
342
|
+
if (aVisualizations[i].Type && aVisualizations[i].Type.indexOf("Chart") >= 0) {
|
|
343
|
+
this.setChartVisualization(aVisualizations[i]);
|
|
344
|
+
} else {
|
|
345
|
+
this.setTableVisualization(aVisualizations[i]);
|
|
346
|
+
}
|
|
340
347
|
}
|
|
341
348
|
}
|
|
342
349
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
return PresentationVariant;
|
|
347
|
-
});
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
);
|