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