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