@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,650 @@
1
+ import { each, rTrim, generateGuidString, extend, loadScriptWithCallback, isApplicationExceptionInstance, stringFormat, escapeHtml, logError, loadScript } from './utils.js';
2
+ import { stringResources } from './stringResources.js';
3
+ import { ServiceClient } from './serviceClient.js';
4
+ import { ReportViewerController } from './controller.js';
5
+ import { HistoryManager } from './history.js';
6
+ import { Binder } from './binder.js';
7
+ import { CommandSet } from './commandSet.js';
8
+ import { UIController } from './uiController.js';
9
+ import { Accessibility } from './accessibility.js';
10
+ import { DocumentMapArea } from './documentMapArea.js';
11
+ import { ParametersArea } from './parametersArea.js';
12
+ import { PagesArea } from './pagesArea.js';
13
+ import { MainMenu } from './mainMenu.js';
14
+ import { Search } from './search.js';
15
+ import { SendEmail } from './sendEmail.js';
16
+ import { SideMenu } from './sideMenu.js';
17
+ import { Events } from './events.js';
18
+ import { PerspectiveManager } from './perspectives.js';
19
+ import { ScaleModes, ViewModes, PageModes, ParametersAreaPositions, DocumentMapAreaPositions, ParameterEditorTypes } from './enums.js';
20
+ import { GlobalSettings } from './globalSettings.js';
21
+ import { MemStorage } from './mem-storage.js';
22
+ import { TemplateCache } from './template-cache.js';
23
+ import { ReportViewerSettings } from './report-viewer/report-viewer-settings.js';
24
+
25
+ const Instances = GlobalSettings.viewerInstances;
26
+ function getDefaultOptions(serviceUrl, version) {
27
+ return {
28
+ id: null,
29
+ serviceUrl: null,
30
+ templateUrl: rTrim(serviceUrl, "\\/") + "/resources/templates/telerikReportViewerTemplate-" + version + ".html/",
31
+ reportSource: null,
32
+ reportServer: null,
33
+ authenticationToken: null,
34
+ sendEmail: null,
35
+ scale: 1,
36
+ scaleMode: ScaleModes.FIT_PAGE,
37
+ viewMode: ViewModes.INTERACTIVE,
38
+ pageMode: PageModes.CONTINUOUS_SCROLL,
39
+ parametersAreaPosition: ParametersAreaPositions.RIGHT,
40
+ documentMapAreaPosition: DocumentMapAreaPositions.LEFT,
41
+ parameters: {
42
+ editors: {
43
+ multiSelect: ParameterEditorTypes.LIST_VIEW,
44
+ singleSelect: ParameterEditorTypes.LIST_VIEW
45
+ }
46
+ },
47
+ persistSession: false,
48
+ parameterEditors: [],
49
+ disabledButtonClass: null,
50
+ checkedButtonClass: null,
51
+ parametersAreaVisible: true,
52
+ documentMapVisible: true,
53
+ enableAccessibility: false,
54
+ searchMetadataOnDemand: false,
55
+ initialPageAreaImageUrl: null,
56
+ keepClientAlive: true
57
+ };
58
+ }
59
+ function ReportViewer(dom, options) {
60
+ var svcApiUrl = options.serviceUrl;
61
+ var reportServerUrlSVCApiUrl = "";
62
+ if (options.reportServer) {
63
+ reportServerUrlSVCApiUrl = rTrim(options.reportServer.url, "\\/");
64
+ svcApiUrl = reportServerUrlSVCApiUrl + "/api/reports";
65
+ }
66
+ var $placeholder = $(dom);
67
+ var templates = {};
68
+ var persistanceKey = options.id || `trv_${dom.id}`;
69
+ var accessibility;
70
+ var settings = {};
71
+ var client = {};
72
+ var controller = {};
73
+ var perspectiveManager = {};
74
+ var history = {};
75
+ var commands = {};
76
+ var viewer = {};
77
+ var serviceClientOptions = {};
78
+ var reportServerUrl = "";
79
+ options.viewerSelector = "reportViewer-" + generateGuidString();
80
+ $placeholder.attr("data-selector", options.viewerSelector);
81
+ if (!validateOptions(options)) {
82
+ return;
83
+ }
84
+ var version = "18.1.24.514";
85
+ options = extend({}, getDefaultOptions(svcApiUrl, version), options);
86
+ settings = new ReportViewerSettings(
87
+ persistanceKey,
88
+ options.persistSession ? window.sessionStorage : new MemStorage(),
89
+ {
90
+ scale: options.scale,
91
+ scaleMode: options.scaleMode,
92
+ printMode: options.printMode ? options.printMode : options.directPrint,
93
+ enableAccessibility: options.enableAccessibility,
94
+ searchMetadataOnDemand: options.searchMetadataOnDemand,
95
+ sendEmail: options.sendEmail,
96
+ parametersAreaPosition: options.parametersAreaPosition,
97
+ documentMapAreaPosition: options.documentMapAreaPosition,
98
+ keepClientAlive: options.keepClientAlive
99
+ }
100
+ );
101
+ if (options.reportServer) {
102
+ reportServerUrl = rTrim(options.reportServer.url, "\\/");
103
+ serviceClientOptions.serviceUrl = reportServerUrl + "/api/reports";
104
+ serviceClientOptions.loginInfo = {
105
+ url: reportServerUrl + "/Token",
106
+ username: options.reportServer.username,
107
+ password: options.reportServer.password
108
+ };
109
+ } else {
110
+ serviceClientOptions.serviceUrl = options.serviceUrl;
111
+ }
112
+ client = new ServiceClient(serviceClientOptions);
113
+ controller = options.controller;
114
+ if (!controller) {
115
+ controller = new ReportViewerController({
116
+ serviceClient: client,
117
+ settings
118
+ });
119
+ } else {
120
+ controller.updateSettings(settings);
121
+ }
122
+ history = new HistoryManager({
123
+ controller,
124
+ settings
125
+ });
126
+ commands = new CommandSet({
127
+ controller,
128
+ history
129
+ });
130
+ new UIController({
131
+ controller,
132
+ history,
133
+ commands
134
+ });
135
+ viewer = {
136
+ stringResources,
137
+ refreshReport: function(ignoreCache) {
138
+ if (arguments.length === 0) {
139
+ ignoreCache = true;
140
+ }
141
+ controller.refreshReport(ignoreCache);
142
+ return viewer;
143
+ },
144
+ reportSource: function(rs) {
145
+ if (rs || rs === null) {
146
+ controller.setReportSource(rs);
147
+ controller.refreshReport(false);
148
+ return viewer;
149
+ }
150
+ return controller.getReportSource();
151
+ },
152
+ clearReportSource: function() {
153
+ controller.clearReportSource();
154
+ return viewer;
155
+ },
156
+ viewMode: function(vm) {
157
+ if (vm) {
158
+ controller.setViewMode(vm);
159
+ return viewer;
160
+ }
161
+ return controller.getViewMode();
162
+ },
163
+ pageMode: function(psm) {
164
+ if (psm) {
165
+ controller.setPageMode(psm);
166
+ return viewer;
167
+ }
168
+ return controller.getPageMode();
169
+ },
170
+ printMode: function(pm) {
171
+ if (pm) {
172
+ controller.setPrintMode(pm);
173
+ return viewer;
174
+ }
175
+ return controller.getPrintMode();
176
+ },
177
+ scale: function({ scale, scaleMode } = {}) {
178
+ if (scale || scaleMode) {
179
+ controller.setScale(scale || controller.getScale());
180
+ controller.setScaleMode(scaleMode || controller.getScaleMode());
181
+ return viewer;
182
+ }
183
+ return {
184
+ scale: controller.getScale(),
185
+ scaleMode: controller.getScaleMode()
186
+ };
187
+ },
188
+ currentPage: function() {
189
+ return controller.getCurrentPageNumber();
190
+ },
191
+ pageCount: function() {
192
+ return controller.getPageCount();
193
+ },
194
+ parametersAreaVisible: function(visible) {
195
+ controller.setParametersAreaVisible({ visible });
196
+ },
197
+ getReportParameters: function() {
198
+ return controller.getReportParameters();
199
+ },
200
+ authenticationToken: function(token) {
201
+ if (token) {
202
+ controller.setAuthenticationToken(token);
203
+ }
204
+ return viewer;
205
+ },
206
+ bind: function(eventName, eventHandler) {
207
+ eventBinder(eventName, eventHandler, true);
208
+ },
209
+ unbind: function(eventName, eventHandler) {
210
+ eventBinder(eventName, eventHandler, false);
211
+ },
212
+ accessibilityKeyMap: function(keyMap) {
213
+ if (accessibility) {
214
+ if (keyMap) {
215
+ accessibility.setKeyMap(keyMap);
216
+ return viewer;
217
+ }
218
+ return accessibility.getKeyMap();
219
+ }
220
+ return void 0;
221
+ },
222
+ commands,
223
+ dispose: function() {
224
+ controller.dispose();
225
+ if (perspectiveManager) {
226
+ perspectiveManager.dispose();
227
+ }
228
+ }
229
+ };
230
+ function validateOptions(options2) {
231
+ if (!options2) {
232
+ $placeholder.text("The report viewer configuration options are not initialized.");
233
+ return false;
234
+ }
235
+ if (options2.reportServer) {
236
+ if (!options2.reportServer.url) {
237
+ $placeholder.text("The report server URL is not specified.");
238
+ return false;
239
+ }
240
+ } else {
241
+ if (!options2.serviceUrl) {
242
+ $placeholder.text("The serviceUrl is not specified.");
243
+ return false;
244
+ }
245
+ }
246
+ return true;
247
+ }
248
+ function eventBinder(eventName, eventHandler, bind) {
249
+ if (typeof eventHandler === "function") {
250
+ if (bind) {
251
+ $(viewer).on(eventName, { sender: viewer }, eventHandler);
252
+ } else {
253
+ $(viewer).off(eventName, eventHandler);
254
+ }
255
+ } else if (!eventHandler && !bind) {
256
+ $(viewer).off(eventName);
257
+ }
258
+ }
259
+ function attachEvents() {
260
+ var eventMap = {
261
+ EXPORT_BEGIN: controller.Events.EXPORT_STARTED,
262
+ EXPORT_END: controller.Events.EXPORT_DOCUMENT_READY,
263
+ PRINT_BEGIN: controller.Events.PRINT_STARTED,
264
+ PRINT_END: controller.Events.PRINT_DOCUMENT_READY,
265
+ RENDERING_BEGIN: controller.Events.BEFORE_LOAD_REPORT,
266
+ RENDERING_END: controller.Events.REPORT_LOAD_COMPLETE,
267
+ PAGE_READY: controller.Events.PAGE_READY,
268
+ ERROR: controller.Events.ERROR,
269
+ UPDATE_UI: controller.Events.UPDATE_UI,
270
+ INTERACTIVE_ACTION_EXECUTING: controller.Events.INTERACTIVE_ACTION_EXECUTING,
271
+ INTERACTIVE_ACTION_ENTER: controller.Events.INTERACTIVE_ACTION_ENTER,
272
+ INTERACTIVE_ACTION_LEAVE: controller.Events.INTERACTIVE_ACTION_LEAVE,
273
+ VIEWER_TOOLTIP_OPENING: controller.Events.TOOLTIP_OPENING,
274
+ SEND_EMAIL_BEGIN: controller.Events.SEND_EMAIL_STARTED,
275
+ SEND_EMAIL_END: controller.Events.SEND_EMAIL_READY
276
+ };
277
+ var $viewer = $(viewer);
278
+ for (const [viewerEvent, controllerEvent] of Object.entries(eventMap)) {
279
+ controller.on(controllerEvent, function(e, args) {
280
+ $viewer.trigger(viewerEvent, args);
281
+ });
282
+ }
283
+ }
284
+ function attachEventHandlers() {
285
+ eventBinder(Events.EXPORT_BEGIN, options.exportBegin, true);
286
+ eventBinder(Events.EXPORT_END, options.exportEnd, true);
287
+ eventBinder(Events.PRINT_BEGIN, options.printBegin, true);
288
+ eventBinder(Events.PRINT_END, options.printEnd, true);
289
+ eventBinder(Events.RENDERING_BEGIN, options.renderingBegin, true);
290
+ eventBinder(Events.RENDERING_END, options.renderingEnd, true);
291
+ eventBinder(Events.PAGE_READY, options.pageReady, true);
292
+ eventBinder(Events.ERROR, options.error, true);
293
+ eventBinder(Events.UPDATE_UI, options.updateUi, true);
294
+ eventBinder(Events.INTERACTIVE_ACTION_EXECUTING, options.interactiveActionExecuting, true);
295
+ eventBinder(Events.INTERACTIVE_ACTION_ENTER, options.interactiveActionEnter, true);
296
+ eventBinder(Events.INTERACTIVE_ACTION_LEAVE, options.interactiveActionLeave, true);
297
+ eventBinder(Events.VIEWER_TOOLTIP_OPENING, options.viewerToolTipOpening, true);
298
+ eventBinder(Events.SEND_EMAIL_BEGIN, options.sendEmailBegin, true);
299
+ eventBinder(Events.SEND_EMAIL_END, options.sendEmailEnd, true);
300
+ }
301
+ function init() {
302
+ $placeholder.html(templates["trv-report-viewer"]);
303
+ Binder.bind(
304
+ $placeholder,
305
+ {
306
+ controller,
307
+ commands,
308
+ templates
309
+ },
310
+ options
311
+ );
312
+ perspectiveManager = new PerspectiveManager(dom, controller);
313
+ perspectiveManager.attach();
314
+ initSplitter();
315
+ attachEvents();
316
+ attachEventHandlers();
317
+ initFromStorage();
318
+ initAccessibility(options);
319
+ }
320
+ function initSplitter() {
321
+ var parameterAreaPaneOptions = {
322
+ max: "500px",
323
+ min: "50px",
324
+ size: "210px",
325
+ collapsible: true
326
+ };
327
+ var parameterAreaTemplate = $placeholder.find(".trv-parameters-area");
328
+ var parameterAreaPanes = [{}];
329
+ var documentMapPaneOptions = {
330
+ max: "500px",
331
+ min: "50px",
332
+ size: "210px",
333
+ collapsible: true,
334
+ collapsed: true
335
+ };
336
+ var documentMapTemplate = $placeholder.find(".trv-document-map");
337
+ var documentMapPanes = [{}];
338
+ var orientation = "horizontal";
339
+ if (options.documentMapAreaPosition === DocumentMapAreaPositions.RIGHT) {
340
+ documentMapTemplate.insertAfter($placeholder.find(".trv-pages-area"));
341
+ documentMapPanes.push(documentMapPaneOptions);
342
+ } else {
343
+ documentMapPanes.unshift(documentMapPaneOptions);
344
+ }
345
+ if (options.parametersAreaPosition === ParametersAreaPositions.TOP || options.parametersAreaPosition === ParametersAreaPositions.BOTTOM) {
346
+ orientation = "vertical";
347
+ parameterAreaTemplate.addClass("-vertical");
348
+ parameterAreaPaneOptions.size = "130px";
349
+ }
350
+ if (options.parametersAreaPosition === ParametersAreaPositions.LEFT || options.parametersAreaPosition === ParametersAreaPositions.TOP) {
351
+ parameterAreaTemplate.insertBefore($placeholder.find(".trv-document-map-splitter"));
352
+ parameterAreaPanes.unshift(parameterAreaPaneOptions);
353
+ } else {
354
+ parameterAreaPanes.push(parameterAreaPaneOptions);
355
+ }
356
+ try {
357
+ var documentMapSplitter = $placeholder.find(".trv-document-map-splitter").kendoSplitter({
358
+ panes: documentMapPanes,
359
+ expand: function(e) {
360
+ setSplitterPaneVisibility(e.pane, true);
361
+ },
362
+ collapse: function(e) {
363
+ setSplitterPaneVisibility(e.pane, false);
364
+ },
365
+ resize: function(e) {
366
+ }
367
+ }).data("kendoSplitter");
368
+ } catch (e) {
369
+ console.error("Instantiation of Kendo Splitter as Document Map splitter threw an exception", e);
370
+ throw e;
371
+ }
372
+ try {
373
+ var parametersSplitter = $placeholder.find(".trv-parameters-splitter").kendoSplitter({
374
+ panes: parameterAreaPanes,
375
+ orientation,
376
+ expand: function(e) {
377
+ setSplitterPaneVisibility(e.pane, true);
378
+ },
379
+ collapse: function(e) {
380
+ setSplitterPaneVisibility(e.pane, false);
381
+ },
382
+ resize: function(e) {
383
+ }
384
+ }).data("kendoSplitter");
385
+ } catch (e) {
386
+ console.error("Instantiation of Kendo Splitter as Parameters area splitter threw an exception", e);
387
+ throw e;
388
+ }
389
+ var parametersSplitterInstance = {
390
+ id: options.viewerSelector + "-parameters-splitter",
391
+ instance: parametersSplitter
392
+ };
393
+ var documentMapSplitterInstance = {
394
+ id: options.viewerSelector + "-document-map-splitter",
395
+ instance: documentMapSplitter
396
+ };
397
+ Instances.push(parametersSplitterInstance);
398
+ Instances.push(documentMapSplitterInstance);
399
+ }
400
+ function setSplitterPaneVisibility(pane, visible) {
401
+ var paneID = $(pane).attr("data-id");
402
+ switch (paneID) {
403
+ case "trv-document-map":
404
+ controller.setDocumentMapVisible({
405
+ visible
406
+ });
407
+ break;
408
+ case "trv-parameters-area":
409
+ controller.setParametersAreaVisible({
410
+ visible
411
+ });
412
+ break;
413
+ }
414
+ }
415
+ function initFromStorage() {
416
+ var vm = settings.getViewMode();
417
+ var psm = settings.getPageMode();
418
+ var pm = settings.getPrintMode();
419
+ var s = settings.getScale();
420
+ var sm = settings.getScaleMode();
421
+ var dm = settings.getDocumentMapVisible();
422
+ var pa = settings.getParametersAreaVisible();
423
+ settings.getAccessibilityKeyMap();
424
+ controller.setViewMode(vm ? vm : options.viewMode);
425
+ controller.setPageMode(psm ? psm : options.pageMode);
426
+ controller.setPrintMode(pm ? pm : options.printMode);
427
+ controller.setScale(s ? s : options.scale);
428
+ controller.setScaleMode(sm ? sm : options.scaleMode);
429
+ controller.setDocumentMapVisible({
430
+ visible: dm ? dm : options.documentMapVisible
431
+ });
432
+ controller.setParametersAreaVisible({
433
+ visible: pa ? pa : options.parametersAreaVisible
434
+ });
435
+ controller.printModeChanged(function() {
436
+ settings.setPrintMode(controller.getPrintMode());
437
+ });
438
+ controller.viewModeChanged(function() {
439
+ settings.setViewMode(controller.getViewMode());
440
+ });
441
+ controller.pageModeChanged(function() {
442
+ settings.setPageMode(controller.getPageMode());
443
+ });
444
+ controller.scaleChanged(function(event, scale) {
445
+ settings.setScale(scale);
446
+ });
447
+ controller.scaleModeChanged(function(event, scaleMode) {
448
+ settings.setScaleMode(scaleMode);
449
+ });
450
+ controller.setSideMenuVisible(function(event, args) {
451
+ window.setTimeout(function() {
452
+ (args.visible ? $.fn.addClass : $.fn.removeClass).call($placeholder, "trv-side-menu-visible");
453
+ }, 1);
454
+ });
455
+ controller.setDocumentMapVisible(function() {
456
+ var args = {};
457
+ controller.getDocumentMapState(args);
458
+ settings.setDocumentMapVisible(args.visible);
459
+ });
460
+ controller.setParametersAreaVisible(function() {
461
+ var args = {};
462
+ controller.getParametersAreaState(args);
463
+ settings.setParametersAreaVisible(args.visible);
464
+ });
465
+ }
466
+ function initAccessibility(options2) {
467
+ if (options2.enableAccessibility) {
468
+ accessibility = new Accessibility({
469
+ controller,
470
+ templates
471
+ });
472
+ var am = options2.accessibilityKeyMap;
473
+ if (am) {
474
+ accessibility.setKeyMap(am);
475
+ }
476
+ settings.contentTabIndex = getTemplateContentTabIndex();
477
+ }
478
+ }
479
+ function getTemplateContentTabIndex() {
480
+ var pageAreaSelector = "div.trv-pages-area";
481
+ try {
482
+ var $pagesArea = $placeholder.find(pageAreaSelector);
483
+ if ($pagesArea.length === 0) {
484
+ throw "Selector " + pageAreaSelector + " did not return a result.";
485
+ }
486
+ return parseInt($pagesArea.attr("tabindex"));
487
+ } catch (e) {
488
+ if (console)
489
+ console.log(e);
490
+ return 0;
491
+ }
492
+ }
493
+ function start() {
494
+ var pendingRefresh = false;
495
+ init();
496
+ controller.reportLoadComplete(function() {
497
+ if (options.documentMapVisible === false) {
498
+ controller.setDocumentMapVisible({ visible: false });
499
+ }
500
+ });
501
+ var rs = settings.getReportSource();
502
+ if (rs !== void 0) {
503
+ controller.setReportSource(rs);
504
+ var pageNumber = settings.getPageNumber();
505
+ if (pageNumber !== void 0) {
506
+ controller.navigateToPage(pageNumber);
507
+ }
508
+ pendingRefresh = true;
509
+ } else {
510
+ if (options.viewMode) {
511
+ controller.setViewMode(options.viewMode);
512
+ }
513
+ if (options.pageMode) {
514
+ controller.setPageMode(options.pageMode);
515
+ }
516
+ if (options.reportSource) {
517
+ controller.setReportSource(options.reportSource);
518
+ pendingRefresh = true;
519
+ }
520
+ }
521
+ if (typeof options.ready === "function") {
522
+ options.ready.call(viewer);
523
+ }
524
+ if (pendingRefresh) {
525
+ controller.refreshReport(false);
526
+ }
527
+ }
528
+ function loadStyleSheets(styleSheets) {
529
+ if (!styleSheets)
530
+ return Promise.resolve();
531
+ var $head = $("head");
532
+ var currentStyleLinks = $head.find("link").map(function(i, e) {
533
+ return e.outerHTML;
534
+ }).toArray();
535
+ var promises = [];
536
+ each(
537
+ styleSheets,
538
+ function(i, e) {
539
+ if (-1 === currentStyleLinks.indexOf(e)) {
540
+ promises.push(
541
+ new Promise(function(resolve, reject) {
542
+ var $link = $(e);
543
+ $link.on("load", resolve);
544
+ $link.on("onerror", function() {
545
+ logError("error loading stylesheet " + e);
546
+ resolve();
547
+ });
548
+ $head.append($link);
549
+ })
550
+ );
551
+ }
552
+ }
553
+ );
554
+ return Promise.all(promises).then(controller.cssLoaded);
555
+ }
556
+ function browserSupportsAllFeatures() {
557
+ return window.Promise;
558
+ }
559
+ function ensureKendo(version2) {
560
+ if (window.kendo) {
561
+ return Promise.resolve();
562
+ } else {
563
+ var kendoUrl = rTrim(svcApiUrl, "\\/") + "/resources/js/telerikReportViewer.kendo-" + version2 + ".min.js/";
564
+ return loadScript(kendoUrl).catch(function(errorData) {
565
+ logError("Kendo could not be loaded automatically. Make sure 'options.serviceUrl' / 'options.reportServer.url' is correct and accessible. The error is: " + errorData.error);
566
+ });
567
+ }
568
+ }
569
+ function main(version2) {
570
+ ensureKendo(version2).then(function() {
571
+ }).then(function() {
572
+ viewer.authenticationToken(options.authenticationToken);
573
+ controller.getServiceVersion().catch(function(ex) {
574
+ var errorOutput = isApplicationExceptionInstance(ex) ? ex.exceptionMessage : stringFormat(stringResources.errorServiceUrl, [escapeHtml(svcApiUrl)]);
575
+ $placeholder.text(errorOutput);
576
+ return Promise.reject();
577
+ }).then(function(data) {
578
+ if (data !== version2) {
579
+ $placeholder.text(stringFormat(stringResources.errorServiceVersion, [data, version2]));
580
+ return Promise.reject();
581
+ }
582
+ TemplateCache.load(options.templateUrl, svcApiUrl, client).catch(function() {
583
+ $placeholder.text(stringFormat(stringResources.errorLoadingTemplates, [escapeHtml(options.templateUrl)]));
584
+ return Promise.reject();
585
+ }).then(function(result) {
586
+ templates = result.templates;
587
+ return loadStyleSheets(result.styleSheets);
588
+ }).then(start);
589
+ });
590
+ });
591
+ }
592
+ if (browserSupportsAllFeatures()) {
593
+ main(version);
594
+ } else {
595
+ loadScriptWithCallback("https://cdn.polyfill.io/v2/polyfill.min.js?features=Promise", main, version);
596
+ }
597
+ return viewer;
598
+ }
599
+ var pluginName = "telerik_ReportViewer";
600
+ $.fn[pluginName] = function(options) {
601
+ if (this.selector && !options.selector) {
602
+ options.selector = this.selector;
603
+ }
604
+ return each(this, function() {
605
+ if (!$.data(this, pluginName)) {
606
+ $.data(this, pluginName, new ReportViewer(this, options));
607
+ }
608
+ });
609
+ };
610
+ const plugins = [
611
+ {
612
+ name: "telerik_ReportViewer_DocumentMapArea",
613
+ constructor: DocumentMapArea
614
+ },
615
+ {
616
+ name: "telerik_ReportViewer_MainMenu",
617
+ constructor: MainMenu
618
+ },
619
+ {
620
+ name: "telerik_ReportViewer_PagesArea",
621
+ constructor: PagesArea
622
+ },
623
+ {
624
+ name: "telerik_ReportViewer_ParametersArea",
625
+ constructor: ParametersArea
626
+ },
627
+ {
628
+ name: "telerik_ReportViewer_SearchDialog",
629
+ constructor: Search
630
+ },
631
+ {
632
+ name: "telerik_ReportViewer_SendEmail",
633
+ constructor: SendEmail
634
+ },
635
+ {
636
+ name: "telerik_ReportViewer_SideMenu",
637
+ constructor: SideMenu
638
+ }
639
+ ];
640
+ plugins.forEach((plugin) => {
641
+ $.fn[plugin.name] = function(options, otherOptions) {
642
+ return each(this, function() {
643
+ if (!$.data(this, plugin.name)) {
644
+ $.data(this, plugin.name, new plugin.constructor(this, options, otherOptions));
645
+ }
646
+ });
647
+ };
648
+ });
649
+
650
+ export { ReportViewer };