@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.
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 +8562 -8606
  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.305.ttf → ReportingIcons-18.1.24.514.ttf} +0 -0
@@ -0,0 +1,637 @@
1
+ import { each, extend, stringFormat, tryParseInt, escapeHtml } from './utils.js';
2
+ import { getMargins, getBorderWidth, getPadding, scale } from './domUtils.js';
3
+ import { stringResources } from './stringResources.js';
4
+ import { TouchBehavior } from './touch.js';
5
+ import { Scroll } from './scroll.js';
6
+ import { UIFreezeCoordinator } from './uiFreezeCoordinator.js';
7
+ import { PageModes, ViewModes, ScaleModes } from './enums.js';
8
+
9
+ var defaultOptions = {};
10
+ function PagesArea(placeholder, options, otherOptions) {
11
+ options = $.extend({}, defaultOptions, options, otherOptions);
12
+ var controller = options.controller;
13
+ if (!controller)
14
+ throw "No controller (telerikReportViewer.reportViewerController) has been specified.";
15
+ var $placeholder = $(placeholder);
16
+ var $pageContainer = $placeholder.find(".trv-page-container");
17
+ var pageContainer = $pageContainer[0];
18
+ var $pageWrapper = $placeholder.find(".trv-page-wrapper");
19
+ var pageWrapper = $pageWrapper[0];
20
+ var $errorMessage = $placeholder.find(".trv-error-message");
21
+ var actions;
22
+ var pendingElement;
23
+ var pageScaleMode = controller.getScaleMode();
24
+ var pageScale = controller.getScale();
25
+ var minPageScale = 0.1;
26
+ var maxPageScale = 8;
27
+ var documentReady = true;
28
+ var navigateToPageOnDocReady;
29
+ var navigateToElementOnDocReady;
30
+ var isNewReportSource;
31
+ var showErrorTimeoutId;
32
+ var showPageAreaImage = false;
33
+ var reportPageIsLoaded = false;
34
+ var pageAreaImageStyle = '.trv-page-container {background: #ffffff url("{0}") no-repeat center 50px}';
35
+ var pageAreaImageID = "trv-initial-image-styles";
36
+ var scroll = extend({}, Scroll, {});
37
+ var uiFreezeCoordinator = null;
38
+ init();
39
+ if (scroll) {
40
+ scroll.init(placeholder, options);
41
+ }
42
+ function init() {
43
+ replaceStringResources($placeholder);
44
+ }
45
+ function replaceStringResources($pagesArea) {
46
+ $pagesArea.attr("aria-label", stringResources[$pagesArea.attr("aria-label")]);
47
+ }
48
+ $(window).on("resize", function(event, args) {
49
+ if (shouldAutosizePage()) {
50
+ updatePageDimensions();
51
+ }
52
+ });
53
+ enableTouch($placeholder);
54
+ function clearPendingTimeoutIds() {
55
+ if (showErrorTimeoutId) {
56
+ window.clearTimeout(showErrorTimeoutId);
57
+ }
58
+ }
59
+ function invalidateCurrentlyLoadedPage() {
60
+ var page = findPage(navigateToPageOnDocReady);
61
+ if (page) {
62
+ pageNo(page, -1);
63
+ }
64
+ }
65
+ function navigateWhenPageAvailable(pageNumber, pageCount) {
66
+ if (pageNumber && pageNumber <= pageCount) {
67
+ navigateToPage(pageNumber, navigateToElementOnDocReady);
68
+ }
69
+ }
70
+ function navigateOnLoadComplete(pageNumber, pageCount) {
71
+ if (pageNumber) {
72
+ pageNumber = Math.min(pageNumber, pageCount);
73
+ navigateToPage(pageNumber, navigateToElementOnDocReady);
74
+ }
75
+ }
76
+ function clearPage() {
77
+ clear(isNewReportSource);
78
+ isNewReportSource = false;
79
+ }
80
+ controller.pageModeChanged(function() {
81
+ if (controller.getPageMode() === PageModes.CONTINUOUS_SCROLL) {
82
+ scroll.enable();
83
+ } else {
84
+ scroll.disable();
85
+ }
86
+ controller.refreshReport(true);
87
+ }).reportSourceChanged(function() {
88
+ isNewReportSource = true;
89
+ navigateToPageOnDocReady = null;
90
+ navigateToElementOnDocReady = null;
91
+ documentReady = false;
92
+ }).beforeLoadParameters(function(event, initial) {
93
+ if (initial) {
94
+ showError(stringResources.loadingReport);
95
+ }
96
+ }).beforeLoadReport(function() {
97
+ documentReady = false;
98
+ if (!navigateToPageOnDocReady) {
99
+ navigateToPageOnDocReady = 1;
100
+ }
101
+ clearPendingTimeoutIds();
102
+ clear();
103
+ disablePagesArea(true);
104
+ showError(stringResources.loadingReport);
105
+ }).beginLoadReport(function(event, args) {
106
+ documentReady = true;
107
+ invalidateCurrentlyLoadedPage();
108
+ }).reportLoadProgress(function(event, args) {
109
+ navigateWhenPageAvailable(navigateToPageOnDocReady, args.pageCount);
110
+ showError(stringFormat(stringResources.loadingReportPagesInProgress, [args.pageCount]));
111
+ }).reportLoadComplete(function(event, args) {
112
+ if (0 === args.pageCount) {
113
+ clearPage();
114
+ showError(stringResources.noPageToDisplay);
115
+ } else {
116
+ navigateOnLoadComplete(navigateToPageOnDocReady, args.pageCount);
117
+ showError(stringFormat(stringResources.loadedReportPagesComplete, [args.pageCount]));
118
+ showErrorTimeoutId = window.setTimeout(showError, 2e3);
119
+ enableInteractivity();
120
+ }
121
+ if (args.containsFrozenContent && !uiFreezeCoordinator) {
122
+ uiFreezeCoordinator = extend({}, UIFreezeCoordinator, {});
123
+ if (controller.getViewMode() === ViewModes.INTERACTIVE) {
124
+ uiFreezeCoordinator.init($placeholder);
125
+ }
126
+ }
127
+ }).navigateToPage(function(event, pageNumber, targetElement) {
128
+ navigateToPage(pageNumber, targetElement);
129
+ }).pageReady(function(event, page) {
130
+ if (controller.getPageMode() === PageModes.SINGLE_PAGE) {
131
+ if (scroll.isEnabled()) {
132
+ scroll.disable();
133
+ }
134
+ setPageContent(page);
135
+ } else {
136
+ scroll.renderPage(page);
137
+ }
138
+ if (!reportPageIsLoaded) {
139
+ reportPageIsLoaded = true;
140
+ }
141
+ if (showPageAreaImage) {
142
+ clearPageAreaImage();
143
+ }
144
+ if (controller.getViewMode() === ViewModes.INTERACTIVE && uiFreezeCoordinator) {
145
+ uiFreezeCoordinator.init($placeholder);
146
+ }
147
+ disablePagesArea(false);
148
+ }).error(function(event, error) {
149
+ disablePagesArea(false);
150
+ clearPage();
151
+ showError(error);
152
+ }).showNotification(function(event, args) {
153
+ showError(stringResources[args.stringResources]);
154
+ }).hideNotification(function(event, args) {
155
+ showError();
156
+ }).scaleChanged(function(event, scale) {
157
+ setPageScale({
158
+ scale,
159
+ scaleMode: controller.getScaleMode()
160
+ });
161
+ }).scaleModeChanged(function(event, scaleMode) {
162
+ setPageScale({
163
+ scale: controller.getScale(),
164
+ scaleMode
165
+ });
166
+ }).serverActionStarted(function() {
167
+ disablePagesArea(true);
168
+ showError(stringResources.loadingReport);
169
+ }).scrollPageReady(function(event, args) {
170
+ setScrollablePage(args);
171
+ }).missingOrInvalidParameters(function(event, args) {
172
+ if (options.initialPageAreaImageUrl && !reportPageIsLoaded) {
173
+ clearPage();
174
+ setPageAreaImage();
175
+ }
176
+ }).renderingStopped(function() {
177
+ clear(true);
178
+ showError(stringResources.renderingCanceled);
179
+ });
180
+ controller.setDocumentMapVisible(function() {
181
+ if (shouldAutosizePage()) {
182
+ setTimeout(function() {
183
+ updatePageDimensions();
184
+ });
185
+ }
186
+ }).setParametersAreaVisible(function() {
187
+ if (shouldAutosizePage()) {
188
+ setTimeout(function() {
189
+ updatePageDimensions();
190
+ });
191
+ }
192
+ });
193
+ function enableTouch(dom) {
194
+ var allowSwipeLeft;
195
+ var allowSwipeRight;
196
+ TouchBehavior(
197
+ dom,
198
+ {
199
+ swipe: function(e) {
200
+ var pageNumber = controller.getCurrentPageNumber();
201
+ if (allowSwipeLeft && e.direction === "left") {
202
+ if (pageNumber < controller.getPageCount()) {
203
+ controller.navigateToPage(pageNumber + 1);
204
+ }
205
+ } else if (allowSwipeRight && e.direction === "right") {
206
+ if (pageNumber > 1) {
207
+ controller.navigateToPage(pageNumber - 1);
208
+ }
209
+ }
210
+ },
211
+ pinch: function(e) {
212
+ var page = getCurrentPage();
213
+ var scale = $(page).data("pageScale") || pageScale;
214
+ var f = e.distance / e.lastDistance;
215
+ setPageScale({
216
+ scale: scale * f,
217
+ scaleMode: ScaleModes.SPECIFIC
218
+ });
219
+ },
220
+ doubletap: function(e) {
221
+ options.commands.toggleZoomMode.exec();
222
+ },
223
+ touchstart: function(e) {
224
+ var el = pageWrapper;
225
+ allowSwipeRight = 0 === el.scrollLeft;
226
+ allowSwipeLeft = el.scrollWidth - el.offsetWidth === el.scrollLeft;
227
+ }
228
+ }
229
+ );
230
+ }
231
+ function shouldAutosizePage() {
232
+ return -1 !== [ScaleModes.FIT_PAGE, ScaleModes.FIT_PAGE_WIDTH].indexOf(pageScaleMode);
233
+ }
234
+ function updatePageDimensions() {
235
+ for (var i = 0, children = $pageContainer.find(".trv-report-page"), len = children.length; i < len; i++) {
236
+ var pageNumber = parseInt($(children[i]).attr("data-page"));
237
+ setPageDimensions(children[i], pageScaleMode, pageScale, pageNumber);
238
+ }
239
+ controller.updatePageDimensionsReady();
240
+ }
241
+ function setPageScale({ scale, scaleMode }) {
242
+ pageScale = scale || pageScale;
243
+ pageScaleMode = scaleMode || pageScaleMode;
244
+ pageScale = Math.max(minPageScale, Math.min(maxPageScale, pageScale));
245
+ updatePageDimensions();
246
+ }
247
+ function clear(clearPageWrapper) {
248
+ disableInteractivity();
249
+ pendingElement = void 0;
250
+ if (clearPageWrapper) {
251
+ $pageWrapper.empty();
252
+ }
253
+ showError();
254
+ }
255
+ function getCurrentPage() {
256
+ return findPage(controller.getCurrentPageNumber());
257
+ }
258
+ function findPage(pageNumber) {
259
+ var result;
260
+ var allPages = $pageContainer.find(".trv-report-page");
261
+ if (controller.getPageMode() === PageModes.SINGLE_PAGE) {
262
+ each(allPages, function(index, page) {
263
+ if (pageNo(page) === pageNumber) {
264
+ result = page;
265
+ }
266
+ return !result;
267
+ });
268
+ } else {
269
+ $.each(allPages, function(index, page) {
270
+ var dataPageNumber = parseInt($(page).attr("data-page"));
271
+ if (dataPageNumber === pageNumber) {
272
+ result = page;
273
+ return false;
274
+ }
275
+ });
276
+ }
277
+ return result;
278
+ }
279
+ function navigateToPage(pageNumber, targetElement) {
280
+ if (documentReady) {
281
+ navigateToPageCore(pageNumber, targetElement);
282
+ } else {
283
+ navigateToPageOnDocumentReady(pageNumber, targetElement);
284
+ }
285
+ }
286
+ function navigateToPageOnDocumentReady(pageNumber, targetElement) {
287
+ navigateToPageOnDocReady = pageNumber;
288
+ navigateToElementOnDocReady = targetElement;
289
+ }
290
+ function navigateToPageCore(pageNumber, targetElement) {
291
+ var page = findPage(pageNumber);
292
+ if (page) {
293
+ if (targetElement) {
294
+ navigateToElement(targetElement, pageNumber);
295
+ }
296
+ if (scroll.isEnabled() && !targetElement) {
297
+ scroll.navigateToElement(page.offsetTop, pageNumber);
298
+ }
299
+ } else {
300
+ pendingElement = targetElement;
301
+ beginLoadPage(pageNumber);
302
+ }
303
+ }
304
+ function navigateToElement(targetElement, pageNumber) {
305
+ if (targetElement) {
306
+ var el = $pageContainer.find("[data-" + targetElement.type + "-id=" + targetElement.id + "]")[0];
307
+ if (el) {
308
+ if (options.enableAccessibility) {
309
+ var $nextFocusable = findNextFocusableElement($(el));
310
+ if ($nextFocusable) {
311
+ $nextFocusable.focus();
312
+ }
313
+ }
314
+ var container = $pageContainer[0];
315
+ var offsetTop = 0;
316
+ var offsetLeft = 0;
317
+ while (el && el !== container) {
318
+ if ($(el).is(".trv-page-wrapper")) {
319
+ var scale = $(el).data("pageScale");
320
+ if (typeof scale === "number") {
321
+ offsetTop *= scale;
322
+ offsetLeft *= scale;
323
+ }
324
+ }
325
+ offsetTop += el.offsetTop;
326
+ offsetLeft += el.offsetLeft;
327
+ el = el.offsetParent;
328
+ }
329
+ if (scroll.isEnabled() && pageNumber) {
330
+ scroll.navigateToElement(offsetTop, pageNumber);
331
+ } else {
332
+ container.scrollTop = offsetTop;
333
+ container.scrollLeft = offsetLeft;
334
+ }
335
+ } else {
336
+ if (scroll.isEnabled() && pageNumber) {
337
+ scroll.navigateToElement($placeholder.find('[data-page="' + pageNumber + '"]')[0].offsetTop, pageNumber);
338
+ }
339
+ }
340
+ }
341
+ }
342
+ function findNextFocusableElement(element) {
343
+ if (!element || element.length === 0) {
344
+ return null;
345
+ }
346
+ var num = tryParseInt(element.attr("tabindex"));
347
+ if (!isNaN(num) && num > -1) {
348
+ return element;
349
+ }
350
+ return findNextFocusableElement(element.next());
351
+ }
352
+ function disablePagesArea(disable) {
353
+ (disable ? $.fn.addClass : $.fn.removeClass).call($placeholder, "trv-loading");
354
+ }
355
+ function showError(error) {
356
+ $errorMessage.text(error);
357
+ (error ? $.fn.addClass : $.fn.removeClass).call($placeholder, "trv-error");
358
+ }
359
+ function pageNo(page, no) {
360
+ var $page = page.$ ? page : $(page);
361
+ var dataKey = "pageNumber";
362
+ if (no === void 0) {
363
+ return $page.data(dataKey);
364
+ }
365
+ $page.data(dataKey, no);
366
+ return page;
367
+ }
368
+ function beginLoadPage(pageNumber) {
369
+ disablePagesArea(true);
370
+ window.setTimeout(controller.getReportPage.bind(controller, pageNumber), 1);
371
+ navigateToPageOnDocReady = null;
372
+ }
373
+ function setPageDimensions(page, scaleMode, scale$1, pageNumber) {
374
+ var $target = $(page);
375
+ var $page = pageNumber ? $target : $target.find("div.trv-report-page");
376
+ var $pageContent = $page.find("div.sheet");
377
+ var $pageSkeletonContent = $page.find("div.trv-skeleton-wrapper");
378
+ var pageContent = $pageContent[0] || $pageSkeletonContent[0];
379
+ var pageSkeletonContent = $pageSkeletonContent[0];
380
+ if (!pageContent) {
381
+ return;
382
+ }
383
+ var pageWidth;
384
+ var pageHeight;
385
+ var box = $target.data("box");
386
+ if (!box) {
387
+ var margins = getMargins($target);
388
+ var borders = getBorderWidth($page);
389
+ var padding = getPadding($page);
390
+ box = {
391
+ padLeft: margins.left + borders.left + padding.left,
392
+ padRight: margins.right + borders.right + padding.right,
393
+ padTop: margins.top + borders.top + padding.top,
394
+ padBottom: margins.bottom + borders.bottom + padding.bottom
395
+ };
396
+ $target.data("box", box);
397
+ }
398
+ if ($target.data("pageWidth") === void 0) {
399
+ pageWidth = pageContent.offsetWidth;
400
+ pageHeight = pageContent.offsetHeight;
401
+ $target.data("pageWidth", pageWidth);
402
+ $target.data("pageHeight", pageHeight);
403
+ } else {
404
+ pageWidth = $target.data("pageWidth");
405
+ pageHeight = $target.data("pageHeight");
406
+ }
407
+ var scrollBarV = pageHeight > pageWidth && scaleMode === ScaleModes.FIT_PAGE_WIDTH ? 20 : 0;
408
+ var scaleW = (pageContainer.clientWidth - scrollBarV - box.padLeft - box.padRight) / pageWidth;
409
+ var scaleH = (pageContainer.clientHeight - 1 - box.padTop - box.padBottom) / pageHeight;
410
+ if (scaleMode === ScaleModes.FIT_PAGE_WIDTH) {
411
+ scale$1 = scaleW;
412
+ } else if (!scale$1 || scaleMode === ScaleModes.FIT_PAGE) {
413
+ scale$1 = Math.min(scaleW, scaleH);
414
+ }
415
+ if (uiFreezeCoordinator) {
416
+ uiFreezeCoordinator.setScaleFactor(scale$1);
417
+ }
418
+ $target.data("pageScale", scale$1);
419
+ $page.data("pageScale", scale$1);
420
+ if (!pageSkeletonContent) {
421
+ scale($pageContent, scale$1, scale$1);
422
+ }
423
+ $page.css({
424
+ "height": scale$1 * pageHeight,
425
+ "width": scale$1 * pageWidth
426
+ });
427
+ }
428
+ function enableInteractivity() {
429
+ $pageContainer.on("click", "[data-reporting-action]", onInteractiveItemClick);
430
+ $pageContainer.on("mouseenter", "[data-reporting-action]", onInteractiveItemEnter);
431
+ $pageContainer.on("mouseleave", "[data-reporting-action]", onInteractiveItemLeave);
432
+ $pageContainer.on("mouseenter", "[data-tooltip-title],[data-tooltip-text]", onToolTipItemEnter);
433
+ $pageContainer.on("mouseleave", "[data-tooltip-title],[data-tooltip-text]", onToolTipItemLeave);
434
+ }
435
+ function disableInteractivity() {
436
+ $pageContainer.off("click", "[data-reporting-action]", onInteractiveItemClick);
437
+ $pageContainer.off("mouseenter", "[data-reporting-action]", onInteractiveItemEnter);
438
+ $pageContainer.off("mouseleave", "[data-reporting-action]", onInteractiveItemLeave);
439
+ $pageContainer.off("mouseenter", "[data-tooltip-title],[data-tooltip-text]", onToolTipItemEnter);
440
+ $pageContainer.off("mouseleave", "[data-tooltip-title],[data-tooltip-text]", onToolTipItemLeave);
441
+ }
442
+ function onInteractiveItemClick(event) {
443
+ var $eventTarget = $(this);
444
+ var actionId = $eventTarget.attr("data-reporting-action");
445
+ var action = getAction(actionId);
446
+ if (action) {
447
+ navigateToPageOnDocReady = getNavigateToPageOnDocReady(event, action.Type);
448
+ controller.executeReportAction({
449
+ element: event.currentTarget,
450
+ action,
451
+ cancel: false
452
+ });
453
+ }
454
+ event.stopPropagation();
455
+ }
456
+ function getNavigateToPageOnDocReady(event, actionType) {
457
+ if (scroll.isEnabled() && (actionType === "sorting" || actionType === "toggleVisibility")) {
458
+ return $(event.target).closest(".trv-report-page").attr("data-page") || controller.getCurrentPageNumber();
459
+ }
460
+ return controller.getCurrentPageNumber();
461
+ }
462
+ function onInteractiveItemEnter(args) {
463
+ var $t = $(this);
464
+ var actionId = $t.attr("data-reporting-action");
465
+ var a = getAction(actionId);
466
+ if (a !== null && args.currentTarget === this) {
467
+ controller.reportActionEnter({
468
+ element: args.currentTarget,
469
+ action: a
470
+ });
471
+ }
472
+ }
473
+ function onInteractiveItemLeave(args) {
474
+ var $t = $(this);
475
+ var actionId = $t.attr("data-reporting-action");
476
+ var a = getAction(actionId);
477
+ if (a !== null && args.currentTarget === this) {
478
+ controller.reportActionLeave({
479
+ element: args.currentTarget,
480
+ action: a
481
+ });
482
+ }
483
+ }
484
+ function getAction(actionId) {
485
+ if (actions) {
486
+ var action;
487
+ each(actions, function() {
488
+ if (this.Id === actionId) {
489
+ action = this;
490
+ }
491
+ return action === void 0;
492
+ });
493
+ return action;
494
+ }
495
+ return null;
496
+ }
497
+ function onToolTipItemEnter(args) {
498
+ var $t = $(this);
499
+ var title = $t.attr("data-tooltip-title");
500
+ var text = $t.attr("data-tooltip-text");
501
+ if (!title && !text) {
502
+ return;
503
+ }
504
+ var toolTipArgs = {
505
+ element: args.currentTarget,
506
+ toolTip: {
507
+ title: title || "",
508
+ text: text || ""
509
+ },
510
+ cancel: false
511
+ };
512
+ controller.reportToolTipOpening(toolTipArgs);
513
+ if (toolTipArgs.cancel) {
514
+ return;
515
+ }
516
+ var content = applyToolTipTemplate(toolTipArgs);
517
+ var viewportElement = args.currentTarget.viewportElement;
518
+ var ktt = getToolTip($t, content);
519
+ ktt.show($t);
520
+ if (viewportElement && viewportElement.nodeName === "svg") {
521
+ positionToolTip(ktt, args);
522
+ }
523
+ }
524
+ function applyToolTipTemplate(toolTipArgs) {
525
+ var toolTipTemplate = options.templates["trv-pages-area-kendo-tooltip"];
526
+ var $container = $(toolTipTemplate);
527
+ var $titleSpan = $container.find(".trv-pages-area-kendo-tooltip-title");
528
+ var $textSpan = $container.find(".trv-pages-area-kendo-tooltip-text");
529
+ $titleSpan.html(replaceNewLineSymbols(toolTipArgs.toolTip.title));
530
+ $textSpan.html(replaceNewLineSymbols(toolTipArgs.toolTip.text));
531
+ return $container.clone().wrap("<p>").parent().html();
532
+ }
533
+ function replaceNewLineSymbols(tooltipText) {
534
+ tooltipText = escapeHtml(tooltipText);
535
+ tooltipText = tooltipText.replaceAll("\r\n", "<br>");
536
+ tooltipText = tooltipText.replaceAll("\n", "<br>");
537
+ return tooltipText;
538
+ }
539
+ function positionToolTip(toolTip, e) {
540
+ var x = e.pageX;
541
+ var y = e.pageY;
542
+ var container = toolTip.popup.element.closest("[role=region]");
543
+ container.css({
544
+ left: x + 10,
545
+ top: y + 5
546
+ });
547
+ }
548
+ function getToolTip(target, toolTipContent) {
549
+ var ktt = target.data("kendoTooltip");
550
+ if (!ktt) {
551
+ try {
552
+ ktt = target.kendoTooltip({
553
+ content: toolTipContent,
554
+ autohide: true,
555
+ callout: false
556
+ }).data("kendoTooltip");
557
+ } catch (e) {
558
+ console.error("Instantiation of Kendo Tooltip threw an exception", e);
559
+ throw e;
560
+ }
561
+ }
562
+ return ktt;
563
+ }
564
+ function onToolTipItemLeave(args) {
565
+ var $t = $(this);
566
+ var toolTip = $t.data("kendoTooltip");
567
+ if (toolTip) {
568
+ toolTip.hide();
569
+ }
570
+ }
571
+ function updatePageStyle(page) {
572
+ var styleId = "trv-" + controller.clientId() + "-styles";
573
+ $("#" + styleId).remove();
574
+ var pageStyles = $("<style id=" + styleId + "></style>");
575
+ pageStyles.append(page.pageStyles);
576
+ pageStyles.appendTo("head");
577
+ }
578
+ function setPageContent(page) {
579
+ actions = JSON.parse(page.pageActions);
580
+ updatePageStyle(page);
581
+ var pageNumber = page.pageNumber;
582
+ var wrapper = $($.parseHTML(page.pageContent));
583
+ var $pageContent = wrapper.find("div.sheet");
584
+ var $page = $('<div class="trv-report-page" data-page="' + pageNumber + '"></div>');
585
+ $pageContent.css("margin", 0);
586
+ $page.append($pageContent).append($('<div class="trv-page-overlay"></div>'));
587
+ var $target = $pageWrapper.empty().removeData().data("pageNumber", pageNumber).append($page);
588
+ controller.setCurrentPageNumber(pageNumber);
589
+ if (controller.getViewMode() === ViewModes.INTERACTIVE) {
590
+ $placeholder.removeClass("printpreview");
591
+ $placeholder.addClass("interactive");
592
+ } else {
593
+ $placeholder.removeClass("interactive");
594
+ $placeholder.addClass("printpreview");
595
+ }
596
+ setPageDimensions($target, pageScaleMode, pageScale);
597
+ $pageContainer.scrollTop(0);
598
+ $pageContainer.scrollLeft(0);
599
+ navigateToElement(pendingElement);
600
+ }
601
+ function setScrollablePage(args) {
602
+ var pageActions = JSON.parse(args.page.pageActions);
603
+ if (!actions) {
604
+ actions = pageActions;
605
+ } else {
606
+ actions = actions.concat(pageActions);
607
+ }
608
+ if (controller.getViewMode() === ViewModes.INTERACTIVE) {
609
+ $placeholder.removeClass("printpreview");
610
+ $placeholder.addClass("interactive");
611
+ } else {
612
+ $placeholder.removeClass("interactive");
613
+ $placeholder.addClass("printpreview");
614
+ }
615
+ setPageDimensions(args.target, pageScaleMode, pageScale, args.page.pageNumber);
616
+ }
617
+ function setPageAreaImage() {
618
+ var pageStyles = $("<style id=" + pageAreaImageID + "></style>");
619
+ clearPageAreaImage();
620
+ pageStyles.append(stringFormat(pageAreaImageStyle, [options.initialPageAreaImageUrl]));
621
+ pageStyles.appendTo("head");
622
+ showPageAreaImage = true;
623
+ }
624
+ function clearPageAreaImage() {
625
+ $("#" + pageAreaImageID).remove();
626
+ }
627
+ }
628
+ var pluginName = "telerik_ReportViewer_PagesArea";
629
+ $.fn[pluginName] = function(options, otherOptions) {
630
+ return each(this, function() {
631
+ if (!$.data(this, pluginName)) {
632
+ $.data(this, pluginName, new PagesArea(this, options, otherOptions));
633
+ }
634
+ });
635
+ };
636
+
637
+ export { PagesArea };