@progress/telerik-jquery-report-viewer 21.24.305 → 22.24.709

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