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