@progress/telerik-jquery-report-viewer 21.24.130 → 22.24.514
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/dist/cjs/accessibility.js +218 -0
- package/dist/cjs/binder.js +172 -0
- package/dist/cjs/command.js +32 -0
- package/dist/cjs/commandSet.js +167 -0
- package/dist/cjs/controller.js +1207 -0
- package/dist/cjs/documentMapArea.js +168 -0
- package/dist/cjs/domUtils.js +50 -0
- package/dist/cjs/enums.js +52 -0
- package/dist/cjs/event-emitter.js +17 -0
- package/dist/cjs/events.js +23 -0
- package/dist/cjs/globalSettings.js +9 -0
- package/dist/cjs/history.js +131 -0
- package/dist/cjs/index.js +58 -0
- package/dist/cjs/jqueryThrottleDebounce.js +48 -0
- package/dist/cjs/kendo-jquery.js +4 -0
- package/dist/cjs/mainMenu.js +332 -0
- package/dist/cjs/mem-storage.js +44 -0
- package/dist/cjs/pagesArea.js +641 -0
- package/dist/cjs/parameterValidators.js +167 -0
- package/dist/cjs/parameters.js +921 -0
- package/dist/cjs/parametersArea.js +502 -0
- package/dist/cjs/perspectives.js +138 -0
- package/dist/cjs/print.js +166 -0
- package/dist/cjs/report-viewer/report-viewer-settings.js +138 -0
- package/dist/cjs/reportViewer.js +654 -0
- package/dist/cjs/scroll.js +537 -0
- package/dist/cjs/search.js +634 -0
- package/dist/cjs/sendEmail.js +435 -0
- package/dist/cjs/service-client-sentinel.js +52 -0
- package/dist/cjs/serviceClient.js +405 -0
- package/dist/cjs/sideMenu.js +225 -0
- package/dist/cjs/sr.js +164 -0
- package/dist/cjs/stringResources.js +11 -0
- package/dist/cjs/telerikReportViewer.kendo.js +60196 -0
- package/dist/cjs/telerikReportViewer.kendo.min.js +19776 -0
- package/dist/cjs/template-cache.js +39 -0
- package/dist/cjs/touch.js +86 -0
- package/dist/cjs/uiController.js +142 -0
- package/dist/cjs/uiFreezeCoordinator.js +281 -0
- package/dist/cjs/utils.js +492 -0
- package/dist/es/accessibility.js +214 -0
- package/dist/es/binder.js +168 -0
- package/dist/es/command.js +28 -0
- package/dist/es/commandSet.js +163 -0
- package/dist/es/controller.js +1203 -0
- package/dist/es/documentMapArea.js +164 -0
- package/dist/es/domUtils.js +43 -0
- package/dist/es/enums.js +41 -0
- package/dist/es/event-emitter.js +13 -0
- package/dist/es/events.js +19 -0
- package/dist/es/globalSettings.js +5 -0
- package/dist/es/history.js +127 -0
- package/dist/es/index.js +24 -0
- package/dist/es/jqueryThrottleDebounce.js +46 -0
- package/dist/es/kendo-jquery.js +1 -0
- package/dist/es/mainMenu.js +328 -0
- package/dist/es/mem-storage.js +40 -0
- package/dist/es/pagesArea.js +637 -0
- package/dist/es/parameterValidators.js +163 -0
- package/dist/es/parameters.js +916 -0
- package/dist/es/parametersArea.js +498 -0
- package/dist/es/perspectives.js +134 -0
- package/dist/es/print.js +162 -0
- package/dist/es/report-viewer/report-viewer-settings.js +134 -0
- package/dist/es/reportViewer.js +650 -0
- package/dist/es/scroll.js +533 -0
- package/dist/es/search.js +630 -0
- package/dist/es/sendEmail.js +431 -0
- package/dist/es/service-client-sentinel.js +48 -0
- package/dist/es/serviceClient.js +401 -0
- package/dist/es/sideMenu.js +221 -0
- package/dist/es/sr.js +162 -0
- package/dist/es/stringResources.js +7 -0
- package/dist/es/telerikReportViewer.kendo.js +60194 -0
- package/dist/es/telerikReportViewer.kendo.min.js +19774 -0
- package/dist/es/template-cache.js +35 -0
- package/dist/es/touch.js +82 -0
- package/dist/es/uiController.js +138 -0
- package/dist/es/uiFreezeCoordinator.js +277 -0
- package/dist/es/utils.js +447 -0
- package/dist/font/font-icons.css +4 -4
- package/dist/font/font-icons.min.css +3 -3
- package/dist/js/telerikReportViewer.js +8574 -8249
- package/dist/js/telerikReportViewer.min.js +1 -17
- package/dist/js/telerikReportViewer.stringResources.js +166 -173
- package/dist/styles/telerikReportViewer.css +1 -1
- package/dist/styles/telerikReportViewer.min.css +1 -1
- package/dist/templates/telerikReportViewerTemplate-FA.html +3 -3
- package/dist/templates/telerikReportViewerTemplate.html +3 -3
- package/package.json +13 -7
- /package/dist/font/{ReportingIcons-18.0.24.130.ttf → ReportingIcons-18.1.24.514.ttf} +0 -0
@@ -0,0 +1,405 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var utils = require('./utils.js');
|
6
|
+
|
7
|
+
var JSON_CONTENT_TYPE = "application/json; charset=UTF-8";
|
8
|
+
var URLENCODED_CONTENT_TYPE = "application/x-www-form-urlencoded; charset=UTF-8";
|
9
|
+
var HTTP_GET = "GET";
|
10
|
+
var HTTP_POST = "POST";
|
11
|
+
var HTTP_DELETE = "DELETE";
|
12
|
+
var defaultOptions = {};
|
13
|
+
function ServiceClient(options) {
|
14
|
+
options = utils.extend({}, defaultOptions, options);
|
15
|
+
var baseUrl = utils.rTrim(options.serviceUrl || options.baseUrl, "\\/");
|
16
|
+
var loginPromise;
|
17
|
+
var _ajax = utils.$ajax;
|
18
|
+
function validateClientID(clientID) {
|
19
|
+
if (!clientID)
|
20
|
+
throw "Invalid clientID";
|
21
|
+
}
|
22
|
+
function urlFromTemplate(template, args) {
|
23
|
+
args = utils.extend({}, { baseUrl }, args);
|
24
|
+
return utils.stringFormat(template, args);
|
25
|
+
}
|
26
|
+
function getHeaderSettings(authorizationToken) {
|
27
|
+
return authorizationToken ? {
|
28
|
+
headers: {
|
29
|
+
Authorization: "Bearer " + authorizationToken
|
30
|
+
}
|
31
|
+
} : {};
|
32
|
+
}
|
33
|
+
function login() {
|
34
|
+
if (!loginPromise) {
|
35
|
+
var loginInfo = options.loginInfo;
|
36
|
+
if (loginInfo && loginInfo.url && (loginInfo.username || loginInfo.password)) {
|
37
|
+
loginPromise = _ajax({
|
38
|
+
url: loginInfo.url,
|
39
|
+
type: HTTP_POST,
|
40
|
+
data: {
|
41
|
+
grant_type: "password",
|
42
|
+
username: loginInfo.username,
|
43
|
+
password: loginInfo.password
|
44
|
+
},
|
45
|
+
dataType: "json",
|
46
|
+
contentType: URLENCODED_CONTENT_TYPE
|
47
|
+
}).then(function(result) {
|
48
|
+
return result.access_token;
|
49
|
+
});
|
50
|
+
} else {
|
51
|
+
loginPromise = Promise.resolve();
|
52
|
+
}
|
53
|
+
}
|
54
|
+
return loginPromise;
|
55
|
+
}
|
56
|
+
return {
|
57
|
+
_urlFromTemplate: urlFromTemplate,
|
58
|
+
registerClient: function(settings) {
|
59
|
+
return login().then(function(authorizationToken) {
|
60
|
+
var ajaxSettings = utils.extend(
|
61
|
+
getHeaderSettings(authorizationToken),
|
62
|
+
settings,
|
63
|
+
{
|
64
|
+
type: HTTP_POST,
|
65
|
+
url: urlFromTemplate("{baseUrl}/clients"),
|
66
|
+
dataType: "json",
|
67
|
+
//Used to avoid Chrome caching functionality for simple async requests
|
68
|
+
//when the first request is not completed the second request is not send
|
69
|
+
//and the same response is used for both of the request. In this case the
|
70
|
+
//second client is not registered to the service and the same clientId is used.
|
71
|
+
data: JSON.stringify({ timeStamp: Date.now() })
|
72
|
+
}
|
73
|
+
);
|
74
|
+
return _ajax(ajaxSettings);
|
75
|
+
}).then(function(clientData) {
|
76
|
+
if (clientData.Message) {
|
77
|
+
throw clientData.Message;
|
78
|
+
}
|
79
|
+
return clientData.clientId;
|
80
|
+
});
|
81
|
+
},
|
82
|
+
unregisterClient: function(clientID, settings) {
|
83
|
+
validateClientID(clientID);
|
84
|
+
return login().then(function(authorizationToken) {
|
85
|
+
var ajaxSettings = utils.extend(
|
86
|
+
getHeaderSettings(authorizationToken),
|
87
|
+
settings,
|
88
|
+
{
|
89
|
+
type: HTTP_DELETE,
|
90
|
+
url: urlFromTemplate("{baseUrl}/clients/{clientID}", { clientID })
|
91
|
+
}
|
92
|
+
);
|
93
|
+
return _ajax(ajaxSettings);
|
94
|
+
});
|
95
|
+
},
|
96
|
+
getParameters: function(clientID, report, parameterValues, settings) {
|
97
|
+
validateClientID(clientID);
|
98
|
+
return login().then(function(authorizationToken) {
|
99
|
+
var ajaxSettings = utils.extend(
|
100
|
+
getHeaderSettings(authorizationToken),
|
101
|
+
settings,
|
102
|
+
{
|
103
|
+
type: HTTP_POST,
|
104
|
+
url: urlFromTemplate("{baseUrl}/clients/{clientID}/parameters", { clientID }),
|
105
|
+
contentType: JSON_CONTENT_TYPE,
|
106
|
+
dataType: "json",
|
107
|
+
data: JSON.stringify({ report, parameterValues })
|
108
|
+
}
|
109
|
+
);
|
110
|
+
return _ajax(ajaxSettings);
|
111
|
+
});
|
112
|
+
},
|
113
|
+
createReportInstance: function(clientID, report, parameterValues, settings) {
|
114
|
+
validateClientID(clientID);
|
115
|
+
return login().then(function(authorizationToken) {
|
116
|
+
var ajaxSettings = utils.extend(
|
117
|
+
getHeaderSettings(authorizationToken),
|
118
|
+
settings,
|
119
|
+
{
|
120
|
+
type: HTTP_POST,
|
121
|
+
url: urlFromTemplate("{baseUrl}/clients/{clientID}/instances", { clientID }),
|
122
|
+
contentType: JSON_CONTENT_TYPE,
|
123
|
+
dataType: "json",
|
124
|
+
data: JSON.stringify({ report, parameterValues })
|
125
|
+
}
|
126
|
+
);
|
127
|
+
return _ajax(ajaxSettings);
|
128
|
+
}).then(function(instanceData) {
|
129
|
+
return instanceData.instanceId;
|
130
|
+
});
|
131
|
+
},
|
132
|
+
deleteReportInstance: function(clientID, instanceID, settings) {
|
133
|
+
validateClientID(clientID);
|
134
|
+
return login().then(function(authorizationToken) {
|
135
|
+
var ajaxSettings = utils.extend(
|
136
|
+
getHeaderSettings(authorizationToken),
|
137
|
+
settings,
|
138
|
+
{
|
139
|
+
type: HTTP_DELETE,
|
140
|
+
url: urlFromTemplate("{baseUrl}/clients/{clientID}/instances/{instanceID}", { clientID, instanceID })
|
141
|
+
}
|
142
|
+
);
|
143
|
+
return _ajax(ajaxSettings);
|
144
|
+
});
|
145
|
+
},
|
146
|
+
createReportDocument: function(clientID, instanceID, format, deviceInfo, useCache, baseDocumentID, actionID, settings) {
|
147
|
+
validateClientID(clientID);
|
148
|
+
return login().then(function(authorizationToken) {
|
149
|
+
deviceInfo = deviceInfo || {};
|
150
|
+
deviceInfo["BasePath"] = baseUrl;
|
151
|
+
var ajaxSettings = utils.extend(
|
152
|
+
getHeaderSettings(authorizationToken),
|
153
|
+
settings,
|
154
|
+
{
|
155
|
+
type: HTTP_POST,
|
156
|
+
url: urlFromTemplate("{baseUrl}/clients/{clientID}/instances/{instanceID}/documents", { clientID, instanceID }),
|
157
|
+
contentType: JSON_CONTENT_TYPE,
|
158
|
+
dataType: "json",
|
159
|
+
data: JSON.stringify(
|
160
|
+
{
|
161
|
+
format,
|
162
|
+
deviceInfo,
|
163
|
+
useCache,
|
164
|
+
baseDocumentID,
|
165
|
+
actionID
|
166
|
+
}
|
167
|
+
)
|
168
|
+
}
|
169
|
+
);
|
170
|
+
return _ajax(ajaxSettings);
|
171
|
+
}).then(function(documentData) {
|
172
|
+
return documentData.documentId;
|
173
|
+
});
|
174
|
+
},
|
175
|
+
sendDocument: function(clientID, instanceID, documentID, mailArgs, settings) {
|
176
|
+
validateClientID(clientID);
|
177
|
+
return login().then(function(authorizationToken) {
|
178
|
+
var ajaxSettings = utils.extend(
|
179
|
+
getHeaderSettings(authorizationToken),
|
180
|
+
settings,
|
181
|
+
{
|
182
|
+
type: HTTP_POST,
|
183
|
+
url: urlFromTemplate(
|
184
|
+
"{baseUrl}/clients/{clientID}/instances/{instanceID}/documents/{documentID}/send",
|
185
|
+
{ clientID, instanceID, documentID }
|
186
|
+
),
|
187
|
+
contentType: JSON_CONTENT_TYPE,
|
188
|
+
data: JSON.stringify(
|
189
|
+
{
|
190
|
+
from: mailArgs.from,
|
191
|
+
to: mailArgs.to,
|
192
|
+
cc: mailArgs.cc,
|
193
|
+
subject: mailArgs.subject,
|
194
|
+
body: mailArgs.body
|
195
|
+
}
|
196
|
+
)
|
197
|
+
}
|
198
|
+
);
|
199
|
+
return _ajax(ajaxSettings);
|
200
|
+
});
|
201
|
+
},
|
202
|
+
deleteReportDocument: function(clientID, instanceID, documentID, settings) {
|
203
|
+
validateClientID(clientID);
|
204
|
+
return login().then(function(authorizationToken) {
|
205
|
+
var ajaxSettings = utils.extend(
|
206
|
+
getHeaderSettings(authorizationToken),
|
207
|
+
settings,
|
208
|
+
{
|
209
|
+
type: HTTP_DELETE,
|
210
|
+
url: urlFromTemplate(
|
211
|
+
"{baseUrl}/clients/{clientID}/instances/{instanceID}/documents/{documentID}",
|
212
|
+
{ clientID, instanceID, documentID }
|
213
|
+
)
|
214
|
+
}
|
215
|
+
);
|
216
|
+
return _ajax(ajaxSettings);
|
217
|
+
});
|
218
|
+
},
|
219
|
+
getDocumentInfo: function(clientID, instanceID, documentID, settings) {
|
220
|
+
validateClientID(clientID);
|
221
|
+
return login().then(function(authorizationToken) {
|
222
|
+
var ajaxSettings = utils.extend(
|
223
|
+
getHeaderSettings(authorizationToken),
|
224
|
+
settings,
|
225
|
+
{
|
226
|
+
type: HTTP_GET,
|
227
|
+
url: urlFromTemplate(
|
228
|
+
"{baseUrl}/clients/{clientID}/instances/{instanceID}/documents/{documentID}/info",
|
229
|
+
{
|
230
|
+
clientID,
|
231
|
+
instanceID,
|
232
|
+
documentID
|
233
|
+
}
|
234
|
+
),
|
235
|
+
dataType: "json"
|
236
|
+
}
|
237
|
+
);
|
238
|
+
return _ajax(ajaxSettings);
|
239
|
+
});
|
240
|
+
},
|
241
|
+
getPage: function(clientID, instanceID, documentID, pageNumber, settings) {
|
242
|
+
validateClientID(clientID);
|
243
|
+
return login().then(function(authorizationToken) {
|
244
|
+
var ajaxSettings = utils.extend(
|
245
|
+
getHeaderSettings(authorizationToken),
|
246
|
+
settings,
|
247
|
+
{
|
248
|
+
type: HTTP_GET,
|
249
|
+
url: urlFromTemplate(
|
250
|
+
"{baseUrl}/clients/{clientID}/instances/{instanceID}/documents/{documentID}/pages/{pageNumber}",
|
251
|
+
{
|
252
|
+
clientID,
|
253
|
+
instanceID,
|
254
|
+
documentID,
|
255
|
+
pageNumber
|
256
|
+
}
|
257
|
+
),
|
258
|
+
dataType: "json"
|
259
|
+
}
|
260
|
+
);
|
261
|
+
return _ajax(ajaxSettings);
|
262
|
+
});
|
263
|
+
},
|
264
|
+
get: function(url) {
|
265
|
+
var ajaxSettings = {
|
266
|
+
type: HTTP_GET,
|
267
|
+
url
|
268
|
+
};
|
269
|
+
return _ajax(ajaxSettings);
|
270
|
+
},
|
271
|
+
formatDocumentUrl: function(clientID, instanceID, documentID, queryString) {
|
272
|
+
var url = urlFromTemplate(
|
273
|
+
"{baseUrl}/clients/{clientID}/instances/{instanceID}/documents/{documentID}",
|
274
|
+
{
|
275
|
+
clientID,
|
276
|
+
instanceID,
|
277
|
+
documentID
|
278
|
+
}
|
279
|
+
);
|
280
|
+
if (queryString) {
|
281
|
+
url += "?" + queryString;
|
282
|
+
}
|
283
|
+
return url;
|
284
|
+
},
|
285
|
+
getDocumentFormats: function(settings) {
|
286
|
+
return login().then(function(authorizationToken) {
|
287
|
+
var ajaxSettings = utils.extend(
|
288
|
+
getHeaderSettings(authorizationToken),
|
289
|
+
settings,
|
290
|
+
{
|
291
|
+
type: HTTP_GET,
|
292
|
+
url: urlFromTemplate("{baseUrl}/formats"),
|
293
|
+
// anonymous
|
294
|
+
dataType: "json"
|
295
|
+
}
|
296
|
+
);
|
297
|
+
return _ajax(ajaxSettings);
|
298
|
+
});
|
299
|
+
},
|
300
|
+
getServiceVersion: function(settings) {
|
301
|
+
return login().then(function(authorizationToken) {
|
302
|
+
var ajaxSettings = utils.extend(
|
303
|
+
getHeaderSettings(authorizationToken),
|
304
|
+
settings,
|
305
|
+
{
|
306
|
+
type: HTTP_GET,
|
307
|
+
url: urlFromTemplate("{baseUrl}/version"),
|
308
|
+
// anonymous
|
309
|
+
dataType: "json"
|
310
|
+
}
|
311
|
+
);
|
312
|
+
return _ajax(ajaxSettings);
|
313
|
+
});
|
314
|
+
},
|
315
|
+
getResource: function(clientID, instanceID, documentID, resourceID, settings) {
|
316
|
+
validateClientID(clientID);
|
317
|
+
return login().then(function(authorizationToken) {
|
318
|
+
var ajaxSettings = utils.extend(
|
319
|
+
getHeaderSettings(authorizationToken),
|
320
|
+
settings,
|
321
|
+
{
|
322
|
+
type: HTTP_GET,
|
323
|
+
url: urlFromTemplate(
|
324
|
+
"{baseUrl}/clients/{clientID}/instances/{instanceID}/documents/{documentID}/resources/{resourceID}",
|
325
|
+
{
|
326
|
+
clientID,
|
327
|
+
instanceID,
|
328
|
+
documentID,
|
329
|
+
resourceID
|
330
|
+
}
|
331
|
+
),
|
332
|
+
dataType: (settings == null ? void 0 : settings.dataType) || "json"
|
333
|
+
}
|
334
|
+
);
|
335
|
+
return _ajax(ajaxSettings);
|
336
|
+
});
|
337
|
+
},
|
338
|
+
getSearchResults: function(clientID, instanceID, documentID, searchToken, matchCase, matchWholeWord, useRegex, settings) {
|
339
|
+
validateClientID(clientID);
|
340
|
+
var searchUrl = urlFromTemplate(
|
341
|
+
"{baseUrl}/clients/{clientID}/instances/{instanceID}/documents/{documentID}/search",
|
342
|
+
{
|
343
|
+
clientID,
|
344
|
+
instanceID,
|
345
|
+
documentID
|
346
|
+
}
|
347
|
+
);
|
348
|
+
return login().then(function(authorizationToken) {
|
349
|
+
var ajaxSettings = utils.extend(
|
350
|
+
getHeaderSettings(authorizationToken),
|
351
|
+
settings,
|
352
|
+
{
|
353
|
+
type: HTTP_POST,
|
354
|
+
url: searchUrl,
|
355
|
+
contentType: JSON_CONTENT_TYPE,
|
356
|
+
dataType: "json",
|
357
|
+
data: JSON.stringify(
|
358
|
+
{
|
359
|
+
searchToken,
|
360
|
+
matchCase,
|
361
|
+
matchWholeWord,
|
362
|
+
useRegularExpressions: useRegex
|
363
|
+
}
|
364
|
+
)
|
365
|
+
}
|
366
|
+
);
|
367
|
+
return _ajax(ajaxSettings);
|
368
|
+
});
|
369
|
+
},
|
370
|
+
setAccessToken: function(accessToken) {
|
371
|
+
loginPromise = Promise.resolve(accessToken);
|
372
|
+
},
|
373
|
+
login,
|
374
|
+
keepClientAlive: function(clientID, settings) {
|
375
|
+
return login().then(function(authorizationToken) {
|
376
|
+
var ajaxSettings = utils.extend(
|
377
|
+
getHeaderSettings(authorizationToken),
|
378
|
+
settings,
|
379
|
+
{
|
380
|
+
type: HTTP_POST,
|
381
|
+
url: urlFromTemplate("{baseUrl}/clients/keepAlive/{clientID}", { clientID })
|
382
|
+
}
|
383
|
+
);
|
384
|
+
return _ajax(ajaxSettings);
|
385
|
+
});
|
386
|
+
},
|
387
|
+
getClientsSessionTimeoutSeconds: function(settings) {
|
388
|
+
return login().then(function(authorizationToken) {
|
389
|
+
var ajaxSettings = utils.extend(
|
390
|
+
getHeaderSettings(authorizationToken),
|
391
|
+
settings,
|
392
|
+
{
|
393
|
+
type: HTTP_GET,
|
394
|
+
url: urlFromTemplate("{baseUrl}/clients/sessionTimeout")
|
395
|
+
}
|
396
|
+
);
|
397
|
+
return _ajax(ajaxSettings);
|
398
|
+
}).then(function(sessionTimeoutData) {
|
399
|
+
return sessionTimeoutData.clientSessionTimeout;
|
400
|
+
});
|
401
|
+
}
|
402
|
+
};
|
403
|
+
}
|
404
|
+
|
405
|
+
exports.ServiceClient = ServiceClient;
|
@@ -0,0 +1,225 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var utils = require('./utils.js');
|
6
|
+
var stringResources = require('./stringResources.js');
|
7
|
+
|
8
|
+
function SideMenu(dom, rootOptions, otherOptions) {
|
9
|
+
var options = $.extend({}, rootOptions, otherOptions);
|
10
|
+
var menu = $(dom).data("kendoMenu");
|
11
|
+
var enableAccessibility = options.enableAccessibility;
|
12
|
+
var DEFAULT_TABINDEX = 3;
|
13
|
+
var panelBar;
|
14
|
+
var sideMenuVisible = false;
|
15
|
+
var controller = options.controller;
|
16
|
+
if (!controller) {
|
17
|
+
throw "No controller (telerikReporting.ReportViewerController) has been specified.";
|
18
|
+
}
|
19
|
+
if (!menu) {
|
20
|
+
init(dom);
|
21
|
+
}
|
22
|
+
function init(root) {
|
23
|
+
var $root = $(root);
|
24
|
+
try {
|
25
|
+
panelBar = $root.children("ul").kendoPanelBar().data("kendoPanelBar");
|
26
|
+
} catch (e) {
|
27
|
+
console.error("Instantiation of Kendo PanelBar as side menu threw an exception", e);
|
28
|
+
throw e;
|
29
|
+
}
|
30
|
+
panelBar.bind("expand", onSubmenuOpen);
|
31
|
+
panelBar.element.off("keydown", onPanelKeyDown);
|
32
|
+
panelBar.element.on("keydown", onPanelKeyDown);
|
33
|
+
setTabIndexes($root);
|
34
|
+
enableCloseOnClick($root);
|
35
|
+
$root.click(function(e) {
|
36
|
+
if (e.target == root) {
|
37
|
+
controller.setSideMenuVisible({ visible: !sideMenuVisible });
|
38
|
+
}
|
39
|
+
});
|
40
|
+
replaceStringResources();
|
41
|
+
}
|
42
|
+
controller.setSideMenuVisible(function(event, args) {
|
43
|
+
setSideMenuVisibility();
|
44
|
+
if (enableAccessibility) {
|
45
|
+
panelBar.element.focus();
|
46
|
+
}
|
47
|
+
sideMenuVisible = args.visible;
|
48
|
+
if (!sideMenuVisible) {
|
49
|
+
panelBar.collapse($("#trv-side-menu-export-command"));
|
50
|
+
}
|
51
|
+
}).getSideMenuVisible(function(event, args) {
|
52
|
+
args.visible = sideMenuVisible;
|
53
|
+
});
|
54
|
+
function setSideMenuVisibility() {
|
55
|
+
var $root = panelBar.element.parent();
|
56
|
+
var hidden = $root.position().left < 0 || !$root.is(":visible");
|
57
|
+
if (hidden) {
|
58
|
+
$root.show();
|
59
|
+
} else {
|
60
|
+
window.setTimeout(function() {
|
61
|
+
$root.hide();
|
62
|
+
}, 500);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
function onSubmenuOpen(e) {
|
66
|
+
var $item = $(e.item);
|
67
|
+
panelBar.unbind("expand", onSubmenuOpen);
|
68
|
+
panelBar.append({ text: stringResources.stringResources.loadingFormats, spriteCssClass: "k-icon k-loading" }, $item);
|
69
|
+
options.controller.getDocumentFormats().then(fillFormats).then(function() {
|
70
|
+
panelBar.expand($item);
|
71
|
+
}).then(function() {
|
72
|
+
panelBar.bind("expand", onSubmenuOpen);
|
73
|
+
});
|
74
|
+
}
|
75
|
+
function fillFormats(formats) {
|
76
|
+
utils.each($(dom).find("ul[data-command-list=export-format-list]"), function() {
|
77
|
+
var $list = $(this);
|
78
|
+
var $parent = $list.parents("li");
|
79
|
+
var tabIndex = $parent.attr("tabindex");
|
80
|
+
if (!tabIndex) {
|
81
|
+
tabIndex = DEFAULT_TABINDEX;
|
82
|
+
}
|
83
|
+
$list.empty();
|
84
|
+
utils.each(formats, function(i) {
|
85
|
+
var format = this;
|
86
|
+
var ariaLabel = enableAccessibility ? utils.stringFormat('aria-label="{localizedName}" ', format) : " ";
|
87
|
+
var li = "<li " + ariaLabel + utils.stringFormat('tabindex="' + tabIndex + '"><a tabindex="-1" href="#" data-command="telerik_ReportViewer_export" data-command-parameter="{name}"><span>{localizedName}</span></a></li>', format);
|
88
|
+
panelBar.append(li, $parent);
|
89
|
+
});
|
90
|
+
setListItemsTabIndex($parent.find("li"), tabIndex);
|
91
|
+
enableCloseOnClick($parent);
|
92
|
+
});
|
93
|
+
}
|
94
|
+
function enableCloseOnClick(root) {
|
95
|
+
utils.each(root.find("li"), function() {
|
96
|
+
var isLeaf = $(this).children("ul").length === 0;
|
97
|
+
if (isLeaf) {
|
98
|
+
$(this).children("a").click(function() {
|
99
|
+
controller.setSideMenuVisible({ visible: !sideMenuVisible });
|
100
|
+
});
|
101
|
+
}
|
102
|
+
});
|
103
|
+
}
|
104
|
+
function setTabIndexes(root) {
|
105
|
+
if (!root) {
|
106
|
+
return;
|
107
|
+
}
|
108
|
+
var $list = root.children("ul");
|
109
|
+
var parentTabIndex = root.attr("tabindex");
|
110
|
+
var listIndex = parentTabIndex ? parentTabIndex : DEFAULT_TABINDEX;
|
111
|
+
setListItemsTabIndex($list, listIndex);
|
112
|
+
}
|
113
|
+
function setListItemsTabIndex(list, tabIndex) {
|
114
|
+
list.attr("tabindex", tabIndex);
|
115
|
+
var items = list.find("li");
|
116
|
+
utils.each(items, function() {
|
117
|
+
var $item = $(this);
|
118
|
+
$item.attr("tabindex", tabIndex);
|
119
|
+
var anchor = $item.children("a");
|
120
|
+
if (anchor.length > 0) {
|
121
|
+
var $anchor = $(anchor);
|
122
|
+
$anchor.attr("tabindex", -1);
|
123
|
+
}
|
124
|
+
$item.focus(function() {
|
125
|
+
var anchor2 = $item.children("a");
|
126
|
+
if (anchor2.length > 0) {
|
127
|
+
anchor2.addClass("k-focus");
|
128
|
+
}
|
129
|
+
});
|
130
|
+
$item.blur(function() {
|
131
|
+
var anchor2 = $item.children("a");
|
132
|
+
if (anchor2.length > 0) {
|
133
|
+
anchor2.removeClass("k-focus");
|
134
|
+
}
|
135
|
+
});
|
136
|
+
$item.off("keydown", onItemKeyDown);
|
137
|
+
$item.on("keydown", onItemKeyDown);
|
138
|
+
});
|
139
|
+
}
|
140
|
+
function onPanelKeyDown(e) {
|
141
|
+
if (e.which == kendo.keys.ENTER) {
|
142
|
+
var $item;
|
143
|
+
var isSelectedFocusedItem = false;
|
144
|
+
var focusedItem = document.activeElement;
|
145
|
+
if (focusedItem && focusedItem.localName == "li") {
|
146
|
+
var items = panelBar.element.find("li.k-item");
|
147
|
+
for (var i = 0; i < items.length; i++) {
|
148
|
+
var listItem = items[i];
|
149
|
+
if (focusedItem === listItem) {
|
150
|
+
$item = $(listItem);
|
151
|
+
isSelectedFocusedItem = true;
|
152
|
+
break;
|
153
|
+
}
|
154
|
+
}
|
155
|
+
} else {
|
156
|
+
$item = panelBar.select();
|
157
|
+
}
|
158
|
+
if (!$item || !$item.length > 0) {
|
159
|
+
return;
|
160
|
+
}
|
161
|
+
handleItemSelect($item, isSelectedFocusedItem);
|
162
|
+
}
|
163
|
+
}
|
164
|
+
function onItemKeyDown(e) {
|
165
|
+
if (e.which == kendo.keys.ENTER) {
|
166
|
+
handleItemSelect($(e.target), false);
|
167
|
+
}
|
168
|
+
}
|
169
|
+
function handleItemSelect(item, handleExpandCollapse) {
|
170
|
+
if (!item.length > 0) {
|
171
|
+
return;
|
172
|
+
}
|
173
|
+
var isLeaf = item.children("ul").length === 0;
|
174
|
+
if (!isLeaf) {
|
175
|
+
if (handleExpandCollapse) {
|
176
|
+
if (item.hasClass("k-active")) {
|
177
|
+
panelBar.collapse(item);
|
178
|
+
} else {
|
179
|
+
panelBar.expand(item);
|
180
|
+
}
|
181
|
+
}
|
182
|
+
} else {
|
183
|
+
var $anchor = item.find("a");
|
184
|
+
if ($anchor.length > 0) {
|
185
|
+
$anchor[0].click();
|
186
|
+
}
|
187
|
+
}
|
188
|
+
}
|
189
|
+
function replaceStringResources() {
|
190
|
+
var menuAreas = findMenuArea();
|
191
|
+
if (!menuAreas) {
|
192
|
+
return;
|
193
|
+
}
|
194
|
+
utils.each(menuAreas, function() {
|
195
|
+
var $menu = $(this);
|
196
|
+
var menuItems = $menu.children("li.k-panelbar-header");
|
197
|
+
$menu.attr("aria-label", stringResources.stringResources[$menu.attr("aria-label")]);
|
198
|
+
utils.each(menuItems, function() {
|
199
|
+
var $menuItem = $(this);
|
200
|
+
var $a = $menuItem.find("a");
|
201
|
+
$menuItem.attr("aria-label", stringResources.stringResources[$menuItem.attr("aria-label")]);
|
202
|
+
if ($a) {
|
203
|
+
var $span = $a.find("span:not(.k-icon)");
|
204
|
+
$a.attr("title", stringResources.stringResources[$a.attr("title")]);
|
205
|
+
if ($span) {
|
206
|
+
$span.text(stringResources.stringResources[$span.text()]);
|
207
|
+
}
|
208
|
+
}
|
209
|
+
});
|
210
|
+
});
|
211
|
+
}
|
212
|
+
function findMenuArea() {
|
213
|
+
return utils.findElement("div[data-role=telerik_ReportViewer_SideMenu] > ul");
|
214
|
+
}
|
215
|
+
}
|
216
|
+
var pluginName = "telerik_ReportViewer_SideMenu";
|
217
|
+
$.fn[pluginName] = function(options, otherOptions) {
|
218
|
+
return utils.each(this, function() {
|
219
|
+
if (!$.data(this, pluginName)) {
|
220
|
+
$.data(this, pluginName, new SideMenu(this, options, otherOptions));
|
221
|
+
}
|
222
|
+
});
|
223
|
+
};
|
224
|
+
|
225
|
+
exports.SideMenu = SideMenu;
|