@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.
Files changed (92) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/accessibility.js +218 -0
  3. package/dist/cjs/binder.js +172 -0
  4. package/dist/cjs/command.js +32 -0
  5. package/dist/cjs/commandSet.js +167 -0
  6. package/dist/cjs/controller.js +1207 -0
  7. package/dist/cjs/documentMapArea.js +168 -0
  8. package/dist/cjs/domUtils.js +50 -0
  9. package/dist/cjs/enums.js +52 -0
  10. package/dist/cjs/event-emitter.js +17 -0
  11. package/dist/cjs/events.js +23 -0
  12. package/dist/cjs/globalSettings.js +9 -0
  13. package/dist/cjs/history.js +131 -0
  14. package/dist/cjs/index.js +58 -0
  15. package/dist/cjs/jqueryThrottleDebounce.js +48 -0
  16. package/dist/cjs/kendo-jquery.js +4 -0
  17. package/dist/cjs/mainMenu.js +332 -0
  18. package/dist/cjs/mem-storage.js +44 -0
  19. package/dist/cjs/pagesArea.js +641 -0
  20. package/dist/cjs/parameterValidators.js +167 -0
  21. package/dist/cjs/parameters.js +921 -0
  22. package/dist/cjs/parametersArea.js +502 -0
  23. package/dist/cjs/perspectives.js +138 -0
  24. package/dist/cjs/print.js +166 -0
  25. package/dist/cjs/report-viewer/report-viewer-settings.js +138 -0
  26. package/dist/cjs/reportViewer.js +654 -0
  27. package/dist/cjs/scroll.js +537 -0
  28. package/dist/cjs/search.js +634 -0
  29. package/dist/cjs/sendEmail.js +435 -0
  30. package/dist/cjs/service-client-sentinel.js +52 -0
  31. package/dist/cjs/serviceClient.js +405 -0
  32. package/dist/cjs/sideMenu.js +225 -0
  33. package/dist/cjs/sr.js +164 -0
  34. package/dist/cjs/stringResources.js +11 -0
  35. package/dist/cjs/telerikReportViewer.kendo.js +60196 -0
  36. package/dist/cjs/telerikReportViewer.kendo.min.js +19776 -0
  37. package/dist/cjs/template-cache.js +39 -0
  38. package/dist/cjs/touch.js +86 -0
  39. package/dist/cjs/uiController.js +142 -0
  40. package/dist/cjs/uiFreezeCoordinator.js +281 -0
  41. package/dist/cjs/utils.js +492 -0
  42. package/dist/es/accessibility.js +214 -0
  43. package/dist/es/binder.js +168 -0
  44. package/dist/es/command.js +28 -0
  45. package/dist/es/commandSet.js +163 -0
  46. package/dist/es/controller.js +1203 -0
  47. package/dist/es/documentMapArea.js +164 -0
  48. package/dist/es/domUtils.js +43 -0
  49. package/dist/es/enums.js +41 -0
  50. package/dist/es/event-emitter.js +13 -0
  51. package/dist/es/events.js +19 -0
  52. package/dist/es/globalSettings.js +5 -0
  53. package/dist/es/history.js +127 -0
  54. package/dist/es/index.js +24 -0
  55. package/dist/es/jqueryThrottleDebounce.js +46 -0
  56. package/dist/es/kendo-jquery.js +1 -0
  57. package/dist/es/mainMenu.js +328 -0
  58. package/dist/es/mem-storage.js +40 -0
  59. package/dist/es/pagesArea.js +637 -0
  60. package/dist/es/parameterValidators.js +163 -0
  61. package/dist/es/parameters.js +916 -0
  62. package/dist/es/parametersArea.js +498 -0
  63. package/dist/es/perspectives.js +134 -0
  64. package/dist/es/print.js +162 -0
  65. package/dist/es/report-viewer/report-viewer-settings.js +134 -0
  66. package/dist/es/reportViewer.js +650 -0
  67. package/dist/es/scroll.js +533 -0
  68. package/dist/es/search.js +630 -0
  69. package/dist/es/sendEmail.js +431 -0
  70. package/dist/es/service-client-sentinel.js +48 -0
  71. package/dist/es/serviceClient.js +401 -0
  72. package/dist/es/sideMenu.js +221 -0
  73. package/dist/es/sr.js +162 -0
  74. package/dist/es/stringResources.js +7 -0
  75. package/dist/es/telerikReportViewer.kendo.js +60194 -0
  76. package/dist/es/telerikReportViewer.kendo.min.js +19774 -0
  77. package/dist/es/template-cache.js +35 -0
  78. package/dist/es/touch.js +82 -0
  79. package/dist/es/uiController.js +138 -0
  80. package/dist/es/uiFreezeCoordinator.js +277 -0
  81. package/dist/es/utils.js +447 -0
  82. package/dist/font/font-icons.css +4 -4
  83. package/dist/font/font-icons.min.css +3 -3
  84. package/dist/js/telerikReportViewer.js +8574 -8249
  85. package/dist/js/telerikReportViewer.min.js +1 -17
  86. package/dist/js/telerikReportViewer.stringResources.js +166 -173
  87. package/dist/styles/telerikReportViewer.css +1 -1
  88. package/dist/styles/telerikReportViewer.min.css +1 -1
  89. package/dist/templates/telerikReportViewerTemplate-FA.html +3 -3
  90. package/dist/templates/telerikReportViewerTemplate.html +3 -3
  91. package/package.json +13 -7
  92. /package/dist/font/{ReportingIcons-18.0.24.130.ttf → ReportingIcons-18.1.24.514.ttf} +0 -0
@@ -0,0 +1,492 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var stringFormatRegExp = /{(\w+?)}/g;
6
+ var specialKeys = {
7
+ DELETE: 46,
8
+ BACKSPACE: 8,
9
+ TAB: 9,
10
+ ESC: 27,
11
+ LEFT: 37,
12
+ UP: 38,
13
+ RIGHT: 39,
14
+ DOWN: 40,
15
+ END: 35,
16
+ HOME: 36
17
+ };
18
+ function isSpecialKey() {
19
+ var userAgent = window.navigator.userAgent.toLowerCase();
20
+ if (userAgent.indexOf("firefox") > -1) {
21
+ var specialKeysArray = Object.keys(specialKeys);
22
+ var specialKeysLength = specialKeysArray.length;
23
+ return function(keyCode) {
24
+ for (var i = 0; i < specialKeysLength; i++) {
25
+ if (specialKeys[specialKeysArray[i]] == keyCode) {
26
+ return true;
27
+ }
28
+ }
29
+ };
30
+ }
31
+ return function(keyCode) {
32
+ return false;
33
+ };
34
+ }
35
+ function toXhrErrorData(xhr, status, error) {
36
+ return {
37
+ xhr,
38
+ status,
39
+ error
40
+ };
41
+ }
42
+ function rectangle(left, top, width, height) {
43
+ return {
44
+ left,
45
+ top,
46
+ width,
47
+ height,
48
+ right: function() {
49
+ return left + width;
50
+ },
51
+ bottom: function() {
52
+ return top + height;
53
+ },
54
+ union: function(other) {
55
+ var newLeft = Math.min(left, other.left);
56
+ var newTop = Math.min(top, other.top);
57
+ var newWidth = Math.max(this.right(), other.right()) - newLeft;
58
+ var newHeight = Math.max(this.bottom(), other.bottom()) - newTop;
59
+ return rectangle(
60
+ newLeft,
61
+ newTop,
62
+ newWidth,
63
+ newHeight
64
+ );
65
+ }
66
+ };
67
+ }
68
+ function generateGuidString() {
69
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
70
+ var r = Math.random() * 16 | 0;
71
+ var v = c == "x" ? r : r & 3 | 8;
72
+ return v.toString(16);
73
+ });
74
+ }
75
+ function trim(s, charlist) {
76
+ return rTrim(lTrim(s, charlist), charlist);
77
+ }
78
+ function replaceAll(str, find, replace) {
79
+ return str.replace(new RegExp(find, "g"), replace);
80
+ }
81
+ function lTrim(s, charlist) {
82
+ if (charlist === void 0) {
83
+ charlist = "s";
84
+ }
85
+ return s.replace(new RegExp("^[" + charlist + "]+"), "");
86
+ }
87
+ function rTrim(s, charlist) {
88
+ if (charlist === void 0) {
89
+ charlist = "s";
90
+ }
91
+ return s.replace(new RegExp("[" + charlist + "]+$"), "");
92
+ }
93
+ function stringFormat(template, data) {
94
+ var isArray2 = Array.isArray(data);
95
+ return template.replace(stringFormatRegExp, function($0, $1) {
96
+ return data[isArray2 ? parseInt($1) : $1];
97
+ });
98
+ }
99
+ function escapeHtml(str) {
100
+ return $("<div>").text(str).html();
101
+ }
102
+ function tryParseInt(value) {
103
+ if (/^(\-|\+)?([0-9]+)$/.test(value)) {
104
+ return Number(value);
105
+ }
106
+ return NaN;
107
+ }
108
+ function tryParseFloat(value) {
109
+ if (/^(\-|\+)?([0-9]+(\.[0-9]+)?)$/.test(value)) {
110
+ return Number(value);
111
+ }
112
+ return NaN;
113
+ }
114
+ function parseToLocalDate(date) {
115
+ if (date instanceof Date)
116
+ return date;
117
+ var isUtc = /Z|[\+\-]\d\d:?\d\d/i.test(date);
118
+ if (!isUtc) {
119
+ date += "Z";
120
+ }
121
+ return new Date(date);
122
+ }
123
+ function adjustTimezone(date) {
124
+ return new Date(
125
+ Date.UTC(
126
+ date.getFullYear(),
127
+ date.getMonth(),
128
+ date.getDate(),
129
+ date.getHours(),
130
+ date.getMinutes(),
131
+ date.getSeconds(),
132
+ date.getMilliseconds()
133
+ )
134
+ );
135
+ }
136
+ function unadjustTimezone(date) {
137
+ return new Date(
138
+ date.getUTCFullYear(),
139
+ date.getUTCMonth(),
140
+ date.getUTCDate(),
141
+ date.getUTCHours(),
142
+ date.getUTCMinutes(),
143
+ date.getUTCSeconds(),
144
+ date.getUTCMilliseconds()
145
+ );
146
+ }
147
+ function areEqual(v1, v2) {
148
+ if (v1 instanceof Date && v2 instanceof Date) {
149
+ if (v1.getTime() !== v2.getTime()) {
150
+ return false;
151
+ }
152
+ } else if (v1 !== v2) {
153
+ return false;
154
+ }
155
+ return true;
156
+ }
157
+ function reportSourcesAreEqual(rs1, rs2) {
158
+ if (rs1 && rs2 && rs1.report === rs2.report) {
159
+ var params1String = "";
160
+ if (rs1.parameters) {
161
+ params1String = JSON.stringify(rs1.parameters);
162
+ }
163
+ var params2String = "";
164
+ if (rs2.parameters) {
165
+ params2String = JSON.stringify(rs2.parameters);
166
+ }
167
+ return params1String === params2String;
168
+ }
169
+ return false;
170
+ }
171
+ function areEqualArrays(array1, array2) {
172
+ if (array1 === null) {
173
+ if (array2 !== null) {
174
+ return false;
175
+ } else {
176
+ return true;
177
+ }
178
+ } else {
179
+ if (array2 === null) {
180
+ return false;
181
+ }
182
+ }
183
+ if (array1.length !== array2.length) {
184
+ return false;
185
+ }
186
+ for (var j = array1.length - 1; j >= 0; j--) {
187
+ if (!areEqual(array1[j], array2[j])) {
188
+ return false;
189
+ }
190
+ }
191
+ return true;
192
+ }
193
+ function isSvgSupported() {
194
+ var matches = /Version\/(\d+.\d+.\d+) Safari/.exec(navigator.userAgent);
195
+ if (matches && matches.length > 1) {
196
+ var version = parseFloat(matches[1]);
197
+ return version >= 6;
198
+ }
199
+ return true;
200
+ }
201
+ function isInternalServerError(error) {
202
+ if (error) {
203
+ return replaceAll(error, " ", "").toLowerCase() === "internalservererror";
204
+ }
205
+ return false;
206
+ }
207
+ function isSystemArgumentException(xhr) {
208
+ var exceptionShortName = "ArgumentException";
209
+ var exceptionInstance = getExceptionInstance(xhr);
210
+ return isExceptionInstanceOfType(exceptionInstance, exceptionShortName, "System." + exceptionShortName);
211
+ }
212
+ function isInvalidClientException(xhr) {
213
+ var exceptionShortName = "InvalidClientException";
214
+ var exceptionInstance = getExceptionInstance(xhr);
215
+ return isExceptionInstanceOfType(exceptionInstance, exceptionShortName, "Telerik.Reporting.Services.Engine." + exceptionShortName);
216
+ }
217
+ function isApplicationException(xhr) {
218
+ return isApplicationExceptionInstance(getExceptionInstance(xhr));
219
+ }
220
+ function isApplicationExceptionInstance(exception) {
221
+ var exceptionShortName = "DrawingFactoryUnavailableException";
222
+ return isExceptionInstanceOfType(exception, exceptionShortName, "Telerik.Drawing.Contract." + exceptionShortName);
223
+ }
224
+ function isExceptionOfType(xhr, exceptionType) {
225
+ return isExceptionInstanceOfType(getExceptionInstance(xhr), exceptionType, exceptionType);
226
+ }
227
+ function isExceptionInstanceOfType(exceptionInstance, exceptionTypeShortName, exceptionTypeFullName) {
228
+ return exceptionInstance && exceptionInstance.exceptionType && exceptionTypeNamesMatch(exceptionInstance.exceptionType, exceptionTypeShortName, exceptionTypeFullName);
229
+ }
230
+ function exceptionTypeNamesMatch(instanceTypeName, exceptionTypeShortName, exceptionTypeFullName) {
231
+ return instanceTypeName && (instanceTypeName === exceptionTypeFullName || instanceTypeName.endsWith(exceptionTypeShortName));
232
+ }
233
+ function parseJSON(json) {
234
+ try {
235
+ return JSON.parse(
236
+ json,
237
+ function(key, value) {
238
+ if (key && value) {
239
+ var firstChar = key.charAt(0);
240
+ if (firstChar === firstChar.toUpperCase()) {
241
+ var newPropertyName = firstChar.toLowerCase() + key.slice(1);
242
+ this[newPropertyName] = value;
243
+ }
244
+ }
245
+ return value;
246
+ }
247
+ );
248
+ } catch (e) {
249
+ return null;
250
+ }
251
+ }
252
+ function getExceptionInstance(xhr) {
253
+ if (!xhr || !xhr.responseText) {
254
+ return false;
255
+ }
256
+ return parseJSON(xhr.responseText);
257
+ }
258
+ function extend() {
259
+ var copy;
260
+ var name;
261
+ var options;
262
+ var target;
263
+ var i = 0;
264
+ var length = arguments.length;
265
+ target = length > 1 ? arguments[i++] || {} : {};
266
+ for (; i < length; i++) {
267
+ if ((options = arguments[i]) != null) {
268
+ for (name in options) {
269
+ target[name];
270
+ copy = options[name];
271
+ if (target === copy) {
272
+ continue;
273
+ }
274
+ if (copy !== void 0) {
275
+ target[name] = copy;
276
+ }
277
+ }
278
+ }
279
+ }
280
+ return target;
281
+ }
282
+ function each(obj, callback) {
283
+ var length;
284
+ var i = 0;
285
+ if (isArray(obj)) {
286
+ length = obj.length;
287
+ for (; i < length; i++) {
288
+ if (callback.call(obj[i], i, obj[i]) === false) {
289
+ break;
290
+ }
291
+ }
292
+ } else {
293
+ for (i in obj) {
294
+ if (callback.call(obj[i], i, obj[i]) === false) {
295
+ break;
296
+ }
297
+ }
298
+ }
299
+ return obj;
300
+ }
301
+ function selector() {
302
+ return document.querySelectorAll(arguments[0]);
303
+ }
304
+ function isArray(obj) {
305
+ if (Array.isArray(obj))
306
+ return true;
307
+ var length = !!obj && "length" in obj && obj.length;
308
+ if (typeof length === "number") {
309
+ return true;
310
+ }
311
+ return false;
312
+ }
313
+ function loadScriptWithCallback(src, done, version) {
314
+ var js = document.createElement("script");
315
+ js.src = src;
316
+ js.onload = function() {
317
+ done(version);
318
+ };
319
+ js.onerror = function() {
320
+ logError(new Error("Failed to load script " + src));
321
+ };
322
+ document.head.appendChild(js);
323
+ }
324
+ function loadScript(url) {
325
+ var ajaxOptions = {
326
+ dataType: "script",
327
+ cache: true,
328
+ url
329
+ };
330
+ return $ajax(ajaxOptions);
331
+ }
332
+ function filterUniqueLastOccurance(array) {
333
+ function onlyLastUnique(value, index, self) {
334
+ return self.lastIndexOf(value) === index;
335
+ }
336
+ return array.filter(onlyLastUnique);
337
+ }
338
+ function logError(error) {
339
+ var console = window.console;
340
+ if (console && console.error) {
341
+ console.error(error);
342
+ }
343
+ }
344
+ function findElement(selectorChain) {
345
+ if (selectorChain.constructor != Array) {
346
+ selectorChain = [selectorChain];
347
+ }
348
+ var $area = $(selectorChain[0]);
349
+ for (var i = 1; i < selectorChain.length; i++) {
350
+ $area = $area.find(selectorChain[i]);
351
+ }
352
+ return $area;
353
+ }
354
+ function toRgbColor(hexColor) {
355
+ if (hexColor && hexColor.length < 6) {
356
+ var index = 1;
357
+ var hexParts = hexColor.split("");
358
+ if (hexParts[0] !== "#") {
359
+ index = 0;
360
+ }
361
+ for (index; index < hexParts.length; index++) {
362
+ hexParts[index] = hexParts[index] + hexParts[index];
363
+ }
364
+ hexColor = hexParts.join("");
365
+ }
366
+ var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexColor);
367
+ return result ? parseInt(result[1], 16) + ", " + parseInt(result[2], 16) + ", " + parseInt(result[3], 16) : null;
368
+ }
369
+ function isRgbColor(color) {
370
+ if (!color) {
371
+ return false;
372
+ }
373
+ return color.indexOf(",") > -1 ? true : false;
374
+ }
375
+ function getColorAlphaValue(color) {
376
+ if (color.toLowerCase() === "transparent") {
377
+ return 0;
378
+ }
379
+ if (!isRgbColor(color)) {
380
+ return 1;
381
+ }
382
+ if (color.indexOf("#") !== -1) {
383
+ color = toRgbColor(color);
384
+ }
385
+ var colorComponents = color.split(",").map(function(c) {
386
+ return c.trim();
387
+ });
388
+ var alpha = colorComponents.length === 4 ? parseFloat((parseFloat(colorComponents[3].replace(/[()]/g, "")) / 255).toFixed(2)) : 1;
389
+ return alpha;
390
+ }
391
+ function $ajax(ajaxSettings) {
392
+ return new Promise(function(resolve, reject) {
393
+ $.ajax(ajaxSettings).done(function(data) {
394
+ return resolve(data);
395
+ }).fail(function(xhr, status, error) {
396
+ reject(toXhrErrorData(xhr, status, error));
397
+ });
398
+ });
399
+ }
400
+ function type(obj) {
401
+ return Object.prototype.toString.call(obj).slice(8, -1);
402
+ }
403
+ function isEqual(a, b) {
404
+ if (a === b) {
405
+ return true;
406
+ }
407
+ if (a !== a && b !== b) {
408
+ return true;
409
+ }
410
+ if (a !== a && b === b || a === a && b !== b) {
411
+ return false;
412
+ }
413
+ const typeA = type(a);
414
+ const typeB = type(b);
415
+ if (typeA !== typeB) {
416
+ return false;
417
+ }
418
+ if (typeA === "Array") {
419
+ if (a.length !== b.length) {
420
+ return false;
421
+ }
422
+ const length = a.length;
423
+ for (let i = 0; i < length; i++) {
424
+ if (!isEqual(a[i], b[i])) {
425
+ return false;
426
+ }
427
+ }
428
+ return true;
429
+ }
430
+ if (typeA === "Object") {
431
+ const keysA = Object.keys(a);
432
+ const keysB = Object.keys(b);
433
+ if (keysA.length !== keysB.length) {
434
+ return false;
435
+ }
436
+ const length = keysA.length;
437
+ for (let i = 0; i < length; i++) {
438
+ const key = keysA[i];
439
+ if (!isEqual(a[key], b[key])) {
440
+ return false;
441
+ }
442
+ }
443
+ return true;
444
+ }
445
+ if (typeA === "Date") {
446
+ return a.getTime() === b.getTime();
447
+ }
448
+ return false;
449
+ }
450
+
451
+ exports.$ajax = $ajax;
452
+ exports.adjustTimezone = adjustTimezone;
453
+ exports.areEqual = areEqual;
454
+ exports.areEqualArrays = areEqualArrays;
455
+ exports.each = each;
456
+ exports.escapeHtml = escapeHtml;
457
+ exports.exceptionTypeNamesMatch = exceptionTypeNamesMatch;
458
+ exports.extend = extend;
459
+ exports.filterUniqueLastOccurance = filterUniqueLastOccurance;
460
+ exports.findElement = findElement;
461
+ exports.generateGuidString = generateGuidString;
462
+ exports.getColorAlphaValue = getColorAlphaValue;
463
+ exports.getExceptionInstance = getExceptionInstance;
464
+ exports.isApplicationException = isApplicationException;
465
+ exports.isApplicationExceptionInstance = isApplicationExceptionInstance;
466
+ exports.isArray = isArray;
467
+ exports.isEqual = isEqual;
468
+ exports.isExceptionOfType = isExceptionOfType;
469
+ exports.isInternalServerError = isInternalServerError;
470
+ exports.isInvalidClientException = isInvalidClientException;
471
+ exports.isRgbColor = isRgbColor;
472
+ exports.isSpecialKey = isSpecialKey;
473
+ exports.isSvgSupported = isSvgSupported;
474
+ exports.isSystemArgumentException = isSystemArgumentException;
475
+ exports.lTrim = lTrim;
476
+ exports.loadScript = loadScript;
477
+ exports.loadScriptWithCallback = loadScriptWithCallback;
478
+ exports.logError = logError;
479
+ exports.parseJSON = parseJSON;
480
+ exports.parseToLocalDate = parseToLocalDate;
481
+ exports.rTrim = rTrim;
482
+ exports.rectangle = rectangle;
483
+ exports.replaceAll = replaceAll;
484
+ exports.reportSourcesAreEqual = reportSourcesAreEqual;
485
+ exports.selector = selector;
486
+ exports.stringFormat = stringFormat;
487
+ exports.toRgbColor = toRgbColor;
488
+ exports.trim = trim;
489
+ exports.tryParseFloat = tryParseFloat;
490
+ exports.tryParseInt = tryParseInt;
491
+ exports.type = type;
492
+ exports.unadjustTimezone = unadjustTimezone;
@@ -0,0 +1,214 @@
1
+ import { findElement, each, stringFormat } from './utils.js';
2
+ import { stringResources } from './stringResources.js';
3
+
4
+ var defaultOptions = {};
5
+ function Accessibility(options) {
6
+ var controller;
7
+ var pageInitialized = false;
8
+ var areas;
9
+ var lastArea;
10
+ var keyMap = {
11
+ //keys for navigating on areas. Used in conjunction with CTRL+ALT to avoid duplicating default shortcuts behavior.
12
+ CONFIRM_KEY: 13,
13
+ CONTENT_AREA_KEY: 67,
14
+ //C
15
+ DOCUMENT_MAP_AREA_KEY: 68,
16
+ //D
17
+ MENU_AREA_KEY: 77,
18
+ //M
19
+ PARAMETERS_AREA_KEY: 80
20
+ //P
21
+ };
22
+ options = $.extend({}, defaultOptions, options);
23
+ controller = options.controller;
24
+ if (!controller) {
25
+ throw "No controller (telerikReporting.ReportViewerController) has been specified.";
26
+ }
27
+ controller.reportLoadComplete(function() {
28
+ setAccessibilityUI();
29
+ var content = findContentArea();
30
+ if (content.length > 0) {
31
+ content.focus();
32
+ }
33
+ }).pageReady(function(event, page) {
34
+ initPage(page);
35
+ pageInitialized = true;
36
+ }).error(function(e, message) {
37
+ focusOnErrorMessage();
38
+ window.setTimeout(setAccessibilityUI, 500);
39
+ });
40
+ controller.updateUI(function(e) {
41
+ if (pageInitialized) {
42
+ setPageSelector();
43
+ decorateMenuItems();
44
+ }
45
+ });
46
+ function setAccessibilityUI() {
47
+ if (!areas) {
48
+ initAreas();
49
+ $(document.body).off("keydown", processKeyDown);
50
+ $(document.body).on("keydown", processKeyDown);
51
+ }
52
+ }
53
+ function focusOnErrorMessage() {
54
+ var selectorChain = ["div.trv-pages-area", "div.trv-error-message"];
55
+ var $errMsg = findElement(selectorChain);
56
+ if ($errMsg.length === 0) {
57
+ return;
58
+ }
59
+ $errMsg.attr("tabIndex", 0);
60
+ $errMsg.focus();
61
+ }
62
+ function initPage(page) {
63
+ if (!page) {
64
+ return;
65
+ }
66
+ setAccessibilityUI();
67
+ var area = areas[keyMap.CONTENT_AREA_KEY];
68
+ setContentAreaKeyDown(area);
69
+ }
70
+ function setPageSelector() {
71
+ var $pagers = $(".trv-report-pager");
72
+ if ($pagers.length > 0) {
73
+ var pageNumber = controller.getCurrentPageNumber();
74
+ var pageCount = controller.getPageCount();
75
+ each($pagers, function() {
76
+ var $pager = $(this);
77
+ $pager.attr("aria-label", stringFormat(stringResources.ariaLabelPageNumberSelector, [pageNumber, pageCount]));
78
+ var $pageInputs = $pager.find("input[data-role=telerik_ReportViewer_PageNumberInput]");
79
+ if ($pageInputs.length > 0) {
80
+ each($pageInputs, function() {
81
+ var $this = $(this);
82
+ $this.attr("aria-label", stringResources.ariaLabelPageNumberEditor);
83
+ $this.attr("min", "1");
84
+ $this.attr("max", "" + pageCount);
85
+ });
86
+ }
87
+ });
88
+ }
89
+ }
90
+ function initAreas() {
91
+ areas = {};
92
+ areas[keyMap.DOCUMENT_MAP_AREA_KEY] = findDocumentMapArea();
93
+ areas[keyMap.MENU_AREA_KEY] = findMenuArea();
94
+ areas[keyMap.CONTENT_AREA_KEY] = findContentArea();
95
+ var parametersArea = findParametersArea();
96
+ if (parametersArea) {
97
+ areas[keyMap.PARAMETERS_AREA_KEY] = parametersArea;
98
+ setParameterEditorsKeyDown(parametersArea);
99
+ }
100
+ }
101
+ function findContentArea() {
102
+ return findElement(["div[data-role=telerik_ReportViewer_PagesArea]"]);
103
+ }
104
+ function findDocumentMapArea() {
105
+ return findElement(["div[data-role=telerik_ReportViewer_DocumentMapArea]", "div[data-role=treeview]"]);
106
+ }
107
+ function findMenuArea() {
108
+ return findElement("ul[data-role=telerik_ReportViewer_MainMenu]");
109
+ }
110
+ function findParametersArea() {
111
+ return findElement(["div[data-role=telerik_ReportViewer_ParametersArea]", "div.trv-parameters-area-content"]);
112
+ }
113
+ function processKeyDown(event) {
114
+ if (!areas) {
115
+ return;
116
+ }
117
+ if (!(event.altKey && event.ctrlKey)) {
118
+ return;
119
+ }
120
+ var currentArea = areas[event.which];
121
+ if (!currentArea) {
122
+ return;
123
+ }
124
+ if (!IsAreaContainerVisible(currentArea.parent())) {
125
+ return;
126
+ }
127
+ var className = "k-focus";
128
+ if (lastArea) {
129
+ lastArea.removeClass(className);
130
+ }
131
+ currentArea.addClass(className);
132
+ currentArea.focus();
133
+ lastArea = currentArea;
134
+ event.preventDefault();
135
+ }
136
+ function setParameterEditorsKeyDown(parametersAreaContent) {
137
+ if (parametersAreaContent.length === 0) {
138
+ return;
139
+ }
140
+ var $paramsArea = parametersAreaContent.parent("div[data-role=telerik_ReportViewer_ParametersArea]");
141
+ if (!IsAreaContainerVisible($paramsArea)) {
142
+ return;
143
+ }
144
+ each(parametersAreaContent.children(), function() {
145
+ $(this).keydown(function(event) {
146
+ if (event.which == keyMap.CONFIRM_KEY) {
147
+ var paramsButton = $paramsArea.find("button.trv-parameters-area-preview-button");
148
+ paramsButton.focus();
149
+ event.preventDefault();
150
+ }
151
+ });
152
+ });
153
+ }
154
+ function IsAreaContainerVisible(container) {
155
+ return container && !(container.hasClass("k-collapsed") || container.hasClass("trv-hidden"));
156
+ }
157
+ function setContentAreaKeyDown(contentArea) {
158
+ if (!contentArea) {
159
+ return;
160
+ }
161
+ var actions = contentArea.find("div [data-reporting-action]");
162
+ if (!actions.length > 0) {
163
+ return;
164
+ }
165
+ each(actions, function() {
166
+ var $action = $(this);
167
+ $action.keydown(function(event) {
168
+ if (event.which == keyMap.CONFIRM_KEY) {
169
+ $action.click();
170
+ }
171
+ });
172
+ });
173
+ }
174
+ function decorateMenuItems() {
175
+ var menuAreas = areas[keyMap.MENU_AREA_KEY];
176
+ if (!menuAreas) {
177
+ return;
178
+ }
179
+ each(menuAreas, function() {
180
+ var $menu = $(this);
181
+ var menuItems = $menu.children("li.k-item");
182
+ each(menuItems, function() {
183
+ var $menuItem = $(this);
184
+ if (!$menuItem.hasClass("trv-report-pager")) {
185
+ var ariaLabel = $menuItem.attr("aria-label");
186
+ var expandableSr = stringFormat(". {0}", [stringResources.ariaLabelExpandable]);
187
+ var expandable = $menuItem.find("ul").length > 0 && ariaLabel.indexOf(expandableSr) < 0 ? expandableSr : "";
188
+ var selectedSr = stringFormat(". {0}", [stringResources.ariaLabelSelected]);
189
+ var selected = $menuItem.hasClass("k-selected") && ariaLabel.indexOf(selectedSr) < 0 ? selectedSr : "";
190
+ var label = ariaLabel + expandable + selected;
191
+ $menuItem.attr("aria-label", label);
192
+ if ($menuItem.hasClass("k-disabled")) {
193
+ $menuItem.attr("aria-disabled", "true");
194
+ } else {
195
+ $menuItem.removeAttr("aria-disabled");
196
+ }
197
+ }
198
+ });
199
+ });
200
+ }
201
+ function setKeyMap(keyMapValues) {
202
+ keyMap = keyMapValues;
203
+ areas = void 0;
204
+ }
205
+ function getKeyMap() {
206
+ return keyMap;
207
+ }
208
+ return {
209
+ getKeyMap,
210
+ setKeyMap
211
+ };
212
+ }
213
+
214
+ export { Accessibility };