@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,1203 @@
1
+ import { extend, tryParseInt, each, logError, isInvalidClientException, isInternalServerError, isApplicationException, getExceptionInstance, stringFormat, parseJSON, escapeHtml, isSystemArgumentException, exceptionTypeNamesMatch, isSvgSupported } from './utils.js';
2
+ import { stringResources } from './stringResources.js';
3
+ import { PrintManager } from './print.js';
4
+ import { ParameterValidators } from './parameterValidators.js';
5
+ import { ViewModes, PageModes, PrintModes, ScaleModes } from './enums.js';
6
+ import { ServiceClientSentinel } from './service-client-sentinel.js';
7
+ import { EventEmitter } from './event-emitter.js';
8
+
9
+ var defaultOptions = {
10
+ pagePollIntervalMs: 500,
11
+ documentInfoPollIntervalMs: 2e3
12
+ };
13
+ function ReportViewerController(options) {
14
+ var controller = {};
15
+ var clientId;
16
+ var reportInstanceId;
17
+ var reportDocumentId;
18
+ var registerClientPromise;
19
+ var registerInstancePromise;
20
+ var documentFormatsPromise;
21
+ var report;
22
+ var parameterValues;
23
+ var processedParameterValues;
24
+ var currentPageNumber;
25
+ var pageCount;
26
+ var viewMode = ViewModes.INTERACTIVE;
27
+ var pageMode = PageModes.CONTINUOUS_SCROLL;
28
+ var loader;
29
+ var printMode = PrintModes.AUTO_SELECT;
30
+ var bookmarkNodes;
31
+ var renderingExtensions;
32
+ var clientHasExpired = false;
33
+ var parameterValidators = ParameterValidators;
34
+ var eventEmitter = new EventEmitter();
35
+ var serviceClientSentinel;
36
+ clearReportState();
37
+ options = extend({}, defaultOptions, options);
38
+ var settings = options.settings;
39
+ if (typeof settings.getPrintMode === "function") {
40
+ printMode = settings.getPrintMode();
41
+ }
42
+ var client = options.serviceClient;
43
+ if (!client) {
44
+ throw stringResources.noServiceClient;
45
+ }
46
+ clientId = settings.getClientId();
47
+ initializeAndStartSentinel();
48
+ function setClientId(id) {
49
+ clientId = id;
50
+ stopSentinel();
51
+ settings.setClientId(clientId);
52
+ initializeAndStartSentinel();
53
+ }
54
+ function clearClientId() {
55
+ clientId = null;
56
+ registerClientPromise = null;
57
+ stopSentinel();
58
+ serviceClientSentinel = null;
59
+ settings.setClientId(null);
60
+ }
61
+ function initializeAndStartSentinel() {
62
+ if (typeof settings.getKeepClientAlive !== "function") {
63
+ throw new Error("Required settings.getKeepClientAlive() is not supplied for ReportViewerController");
64
+ }
65
+ if (settings.getKeepClientAlive() && clientId) {
66
+ return client.getClientsSessionTimeoutSeconds().then(function(sessionTimeout) {
67
+ serviceClientSentinel = new ServiceClientSentinel(client, clientId, sessionTimeout);
68
+ serviceClientSentinel.start();
69
+ });
70
+ }
71
+ }
72
+ function stopSentinel() {
73
+ if (settings.getKeepClientAlive() && !!serviceClientSentinel) {
74
+ serviceClientSentinel.stop();
75
+ }
76
+ }
77
+ function getFormat() {
78
+ if (viewMode === ViewModes.PRINT_PREVIEW) {
79
+ return "HTML5";
80
+ }
81
+ return "HTML5Interactive";
82
+ }
83
+ function handleRequestError(xhrData, localizedMessage, suppressErrorBubbling) {
84
+ var errorMessage = "";
85
+ if (!xhrData.xhr) {
86
+ errorMessage = xhrData;
87
+ controller.raiseError(formatXhrError({ "responseText": errorMessage }, null, null, null));
88
+ throw errorMessage;
89
+ }
90
+ var xhr = xhrData.xhr;
91
+ if (isInvalidClientException(xhr)) {
92
+ onClientExpired();
93
+ }
94
+ var formattedError = formatXhrError(
95
+ xhr,
96
+ xhrData.status,
97
+ isInternalServerError(xhrData.error) ? "" : xhrData.error,
98
+ localizedMessage
99
+ );
100
+ controller.raiseError(formattedError);
101
+ if (!suppressErrorBubbling) {
102
+ if (isApplicationException(xhr)) {
103
+ var exception = getExceptionInstance(xhr);
104
+ if (exception) {
105
+ throw exception;
106
+ }
107
+ }
108
+ throw xhr.responseJSON && xhr.responseJSON.exceptionMessage ? xhr.responseJSON.exceptionMessage : stringResources.promisesChainStopError;
109
+ }
110
+ }
111
+ function initializeClientAsync() {
112
+ if (!registerClientPromise) {
113
+ registerClientPromise = client.registerClient().catch(function(xhrErrorData) {
114
+ handleRequestError(xhrErrorData, stringResources.errorRegisteringViewer);
115
+ }).then(function(clientId2) {
116
+ setClientId(clientId2);
117
+ }).catch(clearClientId);
118
+ }
119
+ return registerClientPromise;
120
+ }
121
+ function registerInstanceAsync() {
122
+ if (!registerInstancePromise) {
123
+ registerInstancePromise = createReportInstanceAsync(report, parameterValues).then(function(instanceId) {
124
+ reportInstanceId = instanceId;
125
+ });
126
+ registerInstancePromise.catch(function(errorMessage) {
127
+ registerInstancePromise = null;
128
+ });
129
+ }
130
+ return registerInstancePromise;
131
+ }
132
+ function clearReportState() {
133
+ reportDocumentId = null;
134
+ reportInstanceId = null;
135
+ registerInstancePromise = null;
136
+ resetPageNumbers();
137
+ }
138
+ function resetPageNumbers() {
139
+ currentPageNumber = pageCount = 0;
140
+ }
141
+ function formatError(args) {
142
+ var len = args.length;
143
+ if (len === 1) {
144
+ return args[0];
145
+ }
146
+ if (len > 1) {
147
+ return stringFormat(args[0], Array.prototype.slice.call(args, 1));
148
+ }
149
+ return "";
150
+ }
151
+ function createReportInstanceAsync(report2, parameterValues2) {
152
+ throwIfNotInitialized();
153
+ return client.createReportInstance(clientId, report2, parameterValues2).catch(function(xhrErrorData) {
154
+ handleRequestError(xhrErrorData, stringFormat(stringResources.errorCreatingReportInstance, [escapeHtml(report2)]));
155
+ });
156
+ }
157
+ function registerDocumentAsync(format, deviceInfo, useCache, baseDocumentId, actionId) {
158
+ throwIfNotInitialized();
159
+ throwIfNoReportInstance();
160
+ return client.createReportDocument(clientId, reportInstanceId, format, deviceInfo, useCache, baseDocumentId, actionId).catch(function(xhrErrorData) {
161
+ handleRequestError(xhrErrorData, stringFormat(stringResources.errorCreatingReportDocument, [escapeHtml(report), escapeHtml(format)]));
162
+ });
163
+ }
164
+ function sendDocumentAsync(documentId, args) {
165
+ throwIfNotInitialized();
166
+ throwIfNoReportInstance();
167
+ return client.sendDocument(clientId, reportInstanceId, documentId, args).catch(function(xhrErrorData) {
168
+ handleRequestError(xhrErrorData, stringFormat(stringResources.errorSendingDocument, [escapeHtml(report)]));
169
+ });
170
+ }
171
+ function getDocumentInfoRecursive(clientId2, instanceId, documentId, options2) {
172
+ if (!options2.isCanceled && instanceId === reportInstanceId) {
173
+ return client.getDocumentInfo(clientId2, instanceId, documentId).catch(handleRequestError).then(function(info) {
174
+ if (info && info.documentReady) {
175
+ return info;
176
+ } else {
177
+ info["promise"] = new Promise(function(resolve, reject) {
178
+ window.setTimeout(resolve, options2.documentInfoPollIntervalMs);
179
+ }).then(function() {
180
+ return getDocumentInfoRecursive(clientId2, instanceId, documentId, options2);
181
+ });
182
+ return info;
183
+ }
184
+ });
185
+ } else {
186
+ return Promise.reject();
187
+ }
188
+ }
189
+ function ReportLoader(reportHost, useCache, baseDocumentId, actionId) {
190
+ var loaderOptions = {};
191
+ function onReportDocumentRegistered(id) {
192
+ if (reportHost) {
193
+ reportDocumentId = id;
194
+ onBeginLoadReport();
195
+ getReportDocumentReady();
196
+ }
197
+ }
198
+ function onBeforeLoadReport(args) {
199
+ loaderOptions.documentInfoPollIntervalMs = options.pagePollIntervalMs;
200
+ if (reportHost) {
201
+ reportHost.beforeLoadReport(args);
202
+ }
203
+ }
204
+ function onBeginLoadReport() {
205
+ if (reportHost) {
206
+ reportHost.beginLoadReport();
207
+ }
208
+ }
209
+ function onReportLoadComplete(info) {
210
+ if (reportHost) {
211
+ reportHost.onReportLoadComplete(info);
212
+ }
213
+ }
214
+ function onReportLoadProgress(info) {
215
+ if (reportHost) {
216
+ pageCount = info.pageCount;
217
+ reportHost.reportLoadProgress(info);
218
+ }
219
+ }
220
+ function getReportDocumentReady() {
221
+ throwIfNotInitialized();
222
+ throwIfNoReportInstance();
223
+ throwIfNoReportDocument();
224
+ progressReportDocumentReady(getDocumentInfoRecursive(clientId, reportInstanceId, reportDocumentId, loaderOptions));
225
+ }
226
+ function progressReportDocumentReady(getDocumentReadyPromise) {
227
+ getDocumentReadyPromise.then(function(info) {
228
+ if (info.documentReady) {
229
+ onReportLoadComplete(info);
230
+ } else {
231
+ onReportLoadProgress(info);
232
+ progressReportDocumentReady(info.promise);
233
+ }
234
+ });
235
+ }
236
+ function getPageAsync(pageNo) {
237
+ return new Promise(function(resolve, reject) {
238
+ var fn = function() {
239
+ client.getPage(clientId, reportInstanceId, reportDocumentId, pageNo).catch(handleRequestError).then(function(pageInfo) {
240
+ if (pageInfo.pageReady) {
241
+ resolve(pageInfo);
242
+ } else {
243
+ window.setTimeout(fn, options.pagePollIntervalMs);
244
+ }
245
+ });
246
+ };
247
+ fn();
248
+ });
249
+ }
250
+ function onBeginLoadPage(pageNo) {
251
+ if (reportHost) {
252
+ reportHost.beginLoadPage(pageNo);
253
+ }
254
+ }
255
+ var loadPromise;
256
+ function loadAsync() {
257
+ if (!loadPromise) {
258
+ var format = getFormat();
259
+ var deviceInfo = createPreviewDeviceInfo();
260
+ onBeforeLoadReport({ deviceInfo });
261
+ loadPromise = initializeClientAsync().then(registerInstanceAsync).then(function() {
262
+ return registerDocumentAsync(format, deviceInfo, useCache, baseDocumentId, actionId);
263
+ }).then(onReportDocumentRegistered);
264
+ }
265
+ return loadPromise;
266
+ }
267
+ function createPreviewDeviceInfo() {
268
+ var deviceInfo = createDeviceInfo();
269
+ deviceInfo.ContentOnly = true;
270
+ deviceInfo.UseSVG = isSvgSupported();
271
+ return deviceInfo;
272
+ }
273
+ return {
274
+ beginLoad: function() {
275
+ loadAsync();
276
+ },
277
+ beginGetPage: function(pageNo) {
278
+ throwIfNotInitialized();
279
+ loadAsync().then(function() {
280
+ onBeginLoadPage(pageNo);
281
+ return getPageAsync(pageNo);
282
+ }).then(function(pageInfo) {
283
+ loaderOptions.documentInfoPollIntervalMs = options.documentInfoPollIntervalMs;
284
+ if (reportHost) {
285
+ reportHost.pageReady(pageInfo);
286
+ }
287
+ });
288
+ },
289
+ getPageData: function(pageNo) {
290
+ throwIfNotInitialized();
291
+ return loadAsync().then(function() {
292
+ return getPageAsync(pageNo);
293
+ });
294
+ },
295
+ dispose: function() {
296
+ reportHost = null;
297
+ },
298
+ cancel: function() {
299
+ loaderOptions.isCanceled = true;
300
+ }
301
+ };
302
+ }
303
+ function createDeviceInfo() {
304
+ var deviceInfo = {};
305
+ if (settings.getEnableAccessibility()) {
306
+ deviceInfo.enableAccessibility = true;
307
+ deviceInfo.contentTabIndex = settings.contentTabIndex;
308
+ }
309
+ var args = {};
310
+ controller.getSearchDialogState(args);
311
+ var searchInitiated = args.visible;
312
+ var searchMetadataOnDemand = settings.getSearchMetadataOnDemand();
313
+ var enableSearch = !searchMetadataOnDemand || searchInitiated;
314
+ deviceInfo.enableSearch = enableSearch;
315
+ return deviceInfo;
316
+ }
317
+ function tryResolveClientErrorByExceptionType(exceptionType) {
318
+ var parameterExceptionShortName = "InvalidParameterException";
319
+ return exceptionTypeNamesMatch(exceptionType, parameterExceptionShortName, "Telerik.Reporting.Services.Engine." + parameterExceptionShortName) ? stringResources.missingOrInvalidParameter : "";
320
+ }
321
+ function formatXhrError(xhr, status, error, localizedMessage) {
322
+ var parsedXhr = parseJSON(xhr.responseText);
323
+ var result = "";
324
+ if (parsedXhr) {
325
+ var errorMessage = tryResolveClientErrorByExceptionType(parsedXhr.exceptionType || parsedXhr.error);
326
+ if (errorMessage) {
327
+ return errorMessage;
328
+ }
329
+ result = escapeHtml(parsedXhr.message);
330
+ var exceptionMessage = escapeHtml(parsedXhr.exceptionMessage || parsedXhr.error_description);
331
+ if (exceptionMessage) {
332
+ if (result) {
333
+ result += " " + exceptionMessage;
334
+ } else {
335
+ result = exceptionMessage;
336
+ }
337
+ }
338
+ } else {
339
+ result = escapeHtml(xhr.responseText);
340
+ }
341
+ if (localizedMessage || error) {
342
+ if (result) {
343
+ result = " " + result;
344
+ }
345
+ result = escapeHtml(localizedMessage ? localizedMessage : error) + result;
346
+ }
347
+ if (isInvalidClientException(xhr)) {
348
+ result += "<br />" + stringResources.clientExpired;
349
+ }
350
+ return result;
351
+ }
352
+ function getReportPage(pageNo) {
353
+ if (loader) {
354
+ loader.beginGetPage(pageNo);
355
+ }
356
+ }
357
+ function loadReportAsync(ignoreCache, baseDocumentId, actionId) {
358
+ if (!report) {
359
+ controller.raiseError(stringResources.noReport);
360
+ return;
361
+ }
362
+ if (loader) {
363
+ loader.dispose();
364
+ loader = null;
365
+ }
366
+ clearReportState();
367
+ loader = new ReportLoader(controller, !ignoreCache, baseDocumentId, actionId);
368
+ loader.beginLoad();
369
+ }
370
+ function printReport() {
371
+ throwIfNoReport();
372
+ var deviceInfo = {
373
+ ImmediatePrint: true
374
+ };
375
+ var printStartArgs = {
376
+ deviceInfo,
377
+ handled: false
378
+ };
379
+ controller.printStarted(printStartArgs);
380
+ if (!printStartArgs.handled) {
381
+ controller.setUIState({
382
+ operationName: "PrintInProgress",
383
+ inProgress: true
384
+ });
385
+ controller.showNotification({ stringResources: "preparingPrint" });
386
+ var canUsePlugin = getCanUsePlugin();
387
+ var contentDisposition = canUsePlugin ? "inline" : "attachment";
388
+ var queryString = "response-content-disposition=" + contentDisposition;
389
+ exportAsync("PDF", deviceInfo).then(
390
+ function(info) {
391
+ var url = client.formatDocumentUrl(info.clientId, info.instanceId, info.documentId, queryString);
392
+ var printEndArgs = {
393
+ url,
394
+ handled: false
395
+ };
396
+ controller.printReady(printEndArgs);
397
+ controller.hideNotification();
398
+ controller.setUIState({
399
+ operationName: "PrintInProgress",
400
+ inProgress: false
401
+ });
402
+ if (!printEndArgs.handled) {
403
+ PrintManager.print(url);
404
+ }
405
+ }
406
+ );
407
+ }
408
+ }
409
+ function getCanUsePlugin() {
410
+ switch (printMode) {
411
+ case PrintModes.FORCE_PDF_FILE:
412
+ case false:
413
+ return false;
414
+ case PrintModes.FORCE_PDF_PLUGIN:
415
+ case true:
416
+ return true;
417
+ default:
418
+ return PrintManager.getDirectPrintState();
419
+ }
420
+ }
421
+ function exportReport(format, deviceInfo) {
422
+ throwIfNoReport();
423
+ if (!deviceInfo) {
424
+ deviceInfo = createDeviceInfo();
425
+ }
426
+ var exportStartArgs = {
427
+ format,
428
+ deviceInfo,
429
+ handled: false
430
+ };
431
+ controller.exportStarted(exportStartArgs);
432
+ if (!exportStartArgs.handled) {
433
+ var queryString = "response-content-disposition=attachment";
434
+ controller.setUIState({
435
+ operationName: "ExportInProgress",
436
+ inProgress: true
437
+ });
438
+ controller.showNotification({ stringResources: "preparingDownload" });
439
+ exportAsync(format, exportStartArgs.deviceInfo).then(
440
+ function(info) {
441
+ var url = client.formatDocumentUrl(info.clientId, info.instanceId, info.documentId, queryString);
442
+ var exportEndArgs = {
443
+ url,
444
+ format,
445
+ handled: false,
446
+ windowOpenTarget: "_self"
447
+ };
448
+ controller.exportReady(exportEndArgs);
449
+ controller.hideNotification();
450
+ controller.setUIState({
451
+ operationName: "ExportInProgress",
452
+ inProgress: false
453
+ });
454
+ if (!exportEndArgs.handled) {
455
+ window.open(url, exportEndArgs.windowOpenTarget);
456
+ }
457
+ }
458
+ );
459
+ }
460
+ }
461
+ function sendReport(args) {
462
+ throwIfNoReport();
463
+ if (!args.deviceInfo) {
464
+ args.deviceInfo = createDeviceInfo();
465
+ }
466
+ var sendEmailStartArgs = {
467
+ deviceInfo: args.deviceInfo,
468
+ handled: false,
469
+ format: args.format
470
+ };
471
+ controller.sendEmailStarted(sendEmailStartArgs);
472
+ var queryString = "response-content-disposition=attachment";
473
+ if (!sendEmailStartArgs.handled) {
474
+ exportAsync(args.format, args.deviceInfo).then(
475
+ function(info) {
476
+ var url = client.formatDocumentUrl(info.clientId, info.instanceId, info.documentId, queryString);
477
+ args["url"] = url;
478
+ args["handled"] = false;
479
+ controller.sendEmailReady(args);
480
+ delete args.deviceInfo;
481
+ if (!args.handled) {
482
+ sendDocumentAsync(info.documentId, args);
483
+ }
484
+ }
485
+ );
486
+ }
487
+ }
488
+ function exportAsync(format, deviceInfo) {
489
+ throwIfNoReport();
490
+ return initializeClientAsync().then(registerInstanceAsync).then(function() {
491
+ return registerDocumentAsync(format, deviceInfo, true, reportDocumentId);
492
+ }).then(function(documentId) {
493
+ return waitReportDocumentReady(clientId, reportInstanceId, documentId, options);
494
+ });
495
+ }
496
+ function waitReportDocumentReady(clientId2, reportInstanceId2, documentId, options2) {
497
+ return new Promise(function(resolve, reject) {
498
+ var fn = function(promise) {
499
+ promise.then(function(info) {
500
+ if (info.documentReady) {
501
+ resolve({
502
+ clientId: clientId2,
503
+ instanceId: reportInstanceId2,
504
+ documentId
505
+ });
506
+ } else {
507
+ fn(info.promise);
508
+ }
509
+ });
510
+ };
511
+ fn(getDocumentInfoRecursive(clientId2, reportInstanceId2, documentId, options2));
512
+ });
513
+ }
514
+ function execServerAction(actionId) {
515
+ throwIfNoReport();
516
+ throwIfNoReportInstance();
517
+ throwIfNoReportDocument();
518
+ onServerActionStarted();
519
+ controller.refreshReportCore(false, reportDocumentId, actionId);
520
+ }
521
+ function throwIfNotInitialized() {
522
+ if (!clientId) {
523
+ throw stringResources.controllerNotInitialized;
524
+ }
525
+ }
526
+ function throwIfNoReportInstance() {
527
+ if (!reportInstanceId) {
528
+ throw stringResources.noReportInstance;
529
+ }
530
+ }
531
+ function throwIfNoReportDocument() {
532
+ if (!reportDocumentId) {
533
+ throw stringResources.noReportDocument;
534
+ }
535
+ }
536
+ function throwIfNoReport() {
537
+ if (!report) {
538
+ throw stringResources.noReport;
539
+ }
540
+ }
541
+ function eventFactory(event, args) {
542
+ if (typeof args[0] === "function") {
543
+ eventEmitter.on(event, args[0]);
544
+ } else {
545
+ eventEmitter.trigger(event, args);
546
+ }
547
+ return controller;
548
+ }
549
+ function loadParametersAsync(report2, paramValues) {
550
+ return initializeClientAsync().then(function() {
551
+ return client.getParameters(clientId, report2, paramValues || parameterValues || {}).catch(function(xhrErrorData) {
552
+ handleRequestError(xhrErrorData, stringResources.unableToGetReportParameters);
553
+ });
554
+ });
555
+ }
556
+ function getDocumentFormatsAsync() {
557
+ if (renderingExtensions) {
558
+ return Promise.resolve(renderingExtensions);
559
+ }
560
+ if (!documentFormatsPromise) {
561
+ documentFormatsPromise = client.getDocumentFormats().catch(handleRequestError);
562
+ }
563
+ return documentFormatsPromise;
564
+ }
565
+ function getServiceVersionAsync() {
566
+ return client.getServiceVersion().catch(handleRequestError);
567
+ }
568
+ function getPageForBookmark(nodes, id) {
569
+ if (nodes) {
570
+ for (var i = 0, len = nodes.length; i < len; i++) {
571
+ var node = nodes[i];
572
+ if (node.id === id) {
573
+ return node.page;
574
+ } else {
575
+ var page = getPageForBookmark(node.items, id);
576
+ if (page) {
577
+ return page;
578
+ }
579
+ }
580
+ }
581
+ }
582
+ return null;
583
+ }
584
+ function fixDataContractJsonSerializer(arr) {
585
+ var dict = {};
586
+ if (Array.isArray(arr)) {
587
+ arr.forEach(function(pair) {
588
+ dict[pair.Key] = pair.Value;
589
+ });
590
+ }
591
+ return dict;
592
+ }
593
+ function changeReportSource(rs) {
594
+ setStateReportSource(rs);
595
+ controller.reportSourceChanged();
596
+ }
597
+ function setStateReportSource(rs) {
598
+ if (typeof settings.setReportSource === "function") {
599
+ settings.setReportSource(rs);
600
+ }
601
+ }
602
+ function changePageNumber(pageNr) {
603
+ settings.setPageNumber(pageNr);
604
+ controller.currentPageChanged();
605
+ }
606
+ var actionHandlers = {
607
+ "sorting": function(action) {
608
+ execServerAction(action.Id);
609
+ },
610
+ "toggleVisibility": function(action) {
611
+ execServerAction(action.Id);
612
+ },
613
+ "navigateToReport": function(action) {
614
+ var args = action.Value;
615
+ onServerActionStarted();
616
+ controller.setReportSource({
617
+ report: args.Report,
618
+ parameters: fixDataContractJsonSerializer(args.ParameterValues)
619
+ });
620
+ controller.refreshReport(false);
621
+ },
622
+ "navigateToUrl": function(action) {
623
+ var args = action.Value;
624
+ window.open(args.Url, args.Target);
625
+ },
626
+ "navigateToBookmark": function(action) {
627
+ var id = action.Value;
628
+ var page = getPageForBookmark(bookmarkNodes, id);
629
+ controller.navigateToPage(page, {
630
+ type: "bookmark",
631
+ id
632
+ });
633
+ },
634
+ "customAction": function(action) {
635
+ }
636
+ };
637
+ function onInteractiveActionExecuting(interactiveActionArgs) {
638
+ controller.interactiveActionExecuting(interactiveActionArgs);
639
+ }
640
+ function executeReportAction(interactiveActionArgs) {
641
+ var action = interactiveActionArgs.action;
642
+ var handler = actionHandlers[action.Type];
643
+ if (typeof handler === "function") {
644
+ window.setTimeout(function() {
645
+ onInteractiveActionExecuting(interactiveActionArgs);
646
+ if (!interactiveActionArgs.cancel) {
647
+ handler(action);
648
+ }
649
+ }, 0);
650
+ }
651
+ }
652
+ function onServerActionStarted() {
653
+ controller.serverActionStarted();
654
+ }
655
+ function onReportActionEnter(args) {
656
+ controller.interactiveActionEnter({
657
+ action: args.action,
658
+ element: args.element
659
+ });
660
+ }
661
+ function onReportActionLeave(args) {
662
+ controller.interactiveActionLeave({
663
+ action: args.action,
664
+ element: args.element
665
+ });
666
+ }
667
+ function onClientExpired() {
668
+ clientHasExpired = true;
669
+ controller.clientExpired();
670
+ }
671
+ function onReportToolTipOpening(args) {
672
+ controller.toolTipOpening(args);
673
+ }
674
+ function getSearchResultsAsync(args) {
675
+ if (!args.searchToken || args.searchToken === "") {
676
+ return Promise.resolve(null);
677
+ }
678
+ return client.getSearchResults(clientId, reportInstanceId, reportDocumentId, args.searchToken, args.matchCase, args.matchWholeWord, args.useRegex).catch(handleSearchResultsError);
679
+ }
680
+ function handleSearchResultsError(xhrData) {
681
+ if (!isSystemArgumentException(xhrData.xhr)) {
682
+ handleRequestError(xhrData, null, true);
683
+ throw null;
684
+ }
685
+ var exceptionDetails = parseJSON(xhrData.xhr.responseText);
686
+ throw exceptionDetails.exceptionMessage;
687
+ }
688
+ function appendInvalidReportParameterNames(invalidParameters) {
689
+ var errorElement = document.querySelector(".trv-pages-area .trv-error-message");
690
+ var invalidParametersHolder = document.createElement("ul");
691
+ for (var index = 0; index < invalidParameters.length; index++) {
692
+ var invalidParameterText = document.createElement("li");
693
+ invalidParameterText.classList.add(invalidParameters[index].name);
694
+ invalidParameterText.innerText = stringFormat("{0} ({1})", [invalidParameters[index].text, invalidParameters[index].name]);
695
+ invalidParametersHolder.appendChild(invalidParameterText);
696
+ }
697
+ errorElement.appendChild(invalidParametersHolder);
698
+ }
699
+ controller.Events = {
700
+ ERROR: "error",
701
+ EXPORT_STARTED: "exportStarted",
702
+ EXPORT_DOCUMENT_READY: "exportDocumentReady",
703
+ PRINT_STARTED: "printStarted",
704
+ PRINT_DOCUMENT_READY: "printDocumentReady",
705
+ BEFORE_LOAD_PARAMETERS: "beforeLoadParameters",
706
+ LOADED_REPORT_CHANGE: "loadedReportChange",
707
+ BEFORE_LOAD_REPORT: "beforeLoadReport",
708
+ BEGIN_LOAD_REPORT: "beginLoadReport",
709
+ REPORT_LOAD_COMPLETE: "reportLoadComplete",
710
+ REPORT_LOAD_PROGRESS: "reportLoadProgress",
711
+ REPORT_LOAD_FAIL: "reportLoadFail",
712
+ BEGIN_LOAD_PAGE: "beginLoadPage",
713
+ PAGE_READY: "pageReady",
714
+ VIEW_MODE_CHANGED: "viewModeChanged",
715
+ PAGE_MODE_CHANGED: "pageModeChanged",
716
+ PRINT_MODE_CHANGED: "printModeChanged",
717
+ REPORT_SOURCE_CHANGED: "reportSourceChanged",
718
+ NAVIGATE_TO_PAGE: "navigateToPage",
719
+ CURRENT_PAGE_CHANGED: "currentPageChanged",
720
+ GET_DOCUMENT_MAP_STATE: "trv.GET_DOCUMENT_MAP_STATE",
721
+ SET_DOCUMENT_MAP_VISIBLE: "trv.SET_DOCUMENT_MAP_VISIBLE",
722
+ GET_PARAMETER_AREA_STATE: "trv.GET_PARAMETER_AREA_STATE",
723
+ SET_PARAMETER_AREA_VISIBLE: "trv.SET_PARAMETER_AREA_VISIBLE",
724
+ SCALE_CHANGED: "scaleChanged",
725
+ SCALE_MODE_CHANGED: "scaleModeChanged",
726
+ SERVER_ACTION_STARTED: "serverActionStarted",
727
+ SET_TOGGLE_SIDE_MENU: "trv.SET_TOGGLE_SIDE_MENU",
728
+ GET_TOGGLE_SIDE_MENU: "trv.GET_TOGGLE_SIDE_MENU",
729
+ UPDATE_UI: "trv.UPDATE_UI",
730
+ CSS_LOADED: "cssLoaded",
731
+ RELOAD_PARAMETERS: "reloadParameters",
732
+ INTERACTIVE_ACTION_EXECUTING: "interactiveActionExecuting",
733
+ INTERACTIVE_ACTION_ENTER: "interactiveActionEnter",
734
+ INTERACTIVE_ACTION_LEAVE: "interactiveActionLeave",
735
+ UPDATE_UI_INTERNAL: "trv.UPDATE_UI_INTERNAL",
736
+ CLIENT_EXPIRED: "clientExpired",
737
+ TOOLTIP_OPENING: "tooltipOpening",
738
+ TOOLTIP_CLOSING: "tooltipClosing",
739
+ PAGE_NUMBER: "trv.PAGE_NUMBER",
740
+ PAGE_COUNT: "trv.PAGE_COUNT",
741
+ GET_SEARCH_DIALOG_STATE: "trv.GET_SEARCH_DIALOG_STATE",
742
+ GET_SEND_EMAIL_DIALOG_STATE: "trv.GET_SEND_EMAIL_DIALOG_STATE",
743
+ SET_SEARCH_DIALOG_VISIBLE: "trv.SET_SEARCH_DIALOG_VISIBLE",
744
+ SET_SEND_EMAIL_DIALOG_VISIBLE: "trv.SET_SEND_EMAIL_DIALOG_VISIBLE",
745
+ SEND_EMAIL_STARTED: "sendEmailStarted",
746
+ SEND_EMAIL_READY: "sendEmailDocumentReady",
747
+ SHOW_NOTIFICATION: "trv.SHOW_NOTIFICATION",
748
+ HIDE_NOTIFICATION: "trv.HIDE_NOTIFICATION",
749
+ UI_STATE: "trv.UI_STATE",
750
+ SCROLL_PAGE_READY: "scrollPageReady",
751
+ UPDATE_SCROLL_PAGE_DIMENSIONS_READY: "trv.UPDATE_SCROLL_PAGE_DIMENSIONS_READY",
752
+ MISSING_OR_INVALID_PARAMETERS: "missingOrInvalidParameters",
753
+ RENDERING_STOPPED: "renderingStopped"
754
+ };
755
+ extend(
756
+ controller,
757
+ {
758
+ getPageData: function(pageNumber) {
759
+ if (loader) {
760
+ return loader.getPageData(pageNumber);
761
+ }
762
+ return;
763
+ },
764
+ getReportSource: function() {
765
+ if (report === null) {
766
+ return null;
767
+ }
768
+ return {
769
+ report,
770
+ parameters: extend({}, parameterValues)
771
+ };
772
+ },
773
+ setReportSource: function(rs) {
774
+ if (rs === null) {
775
+ report = parameterValues = null;
776
+ clearReportState();
777
+ changeReportSource(rs);
778
+ return this;
779
+ }
780
+ report = rs.report;
781
+ parameterValues = rs.parameters;
782
+ changeReportSource(rs);
783
+ return this;
784
+ },
785
+ updateSettings: function(settings2) {
786
+ options.settings = extend({}, settings2, options.settings);
787
+ },
788
+ clearReportSource: function() {
789
+ report = parameterValues = null;
790
+ clearReportState();
791
+ changeReportSource(void 0);
792
+ return this;
793
+ },
794
+ getReportDocumentId: function() {
795
+ return reportDocumentId;
796
+ },
797
+ setReportDocumentId: function(documentId) {
798
+ reportDocumentId = documentId;
799
+ },
800
+ setParameters: function(paramValues) {
801
+ parameterValues = paramValues;
802
+ },
803
+ setProcessedParameter: function(processedParamValues) {
804
+ processedParameterValues = processedParamValues;
805
+ },
806
+ getPageCount: function() {
807
+ return pageCount;
808
+ },
809
+ getCurrentPageNumber: function() {
810
+ return currentPageNumber;
811
+ },
812
+ setCurrentPageNumber: function(pageNo) {
813
+ var num = tryParseInt(pageNo);
814
+ if (num !== currentPageNumber) {
815
+ currentPageNumber = num;
816
+ changePageNumber(num);
817
+ }
818
+ return this;
819
+ },
820
+ getScale: function() {
821
+ return settings.getScale();
822
+ },
823
+ setScale: function(scale) {
824
+ if (settings.getScale() !== scale) {
825
+ settings.setScale(scale);
826
+ controller.scaleChanged(scale);
827
+ controller.setScaleMode(ScaleModes.SPECIFIC);
828
+ }
829
+ return controller;
830
+ },
831
+ getScaleMode: function() {
832
+ return settings.getScaleMode();
833
+ },
834
+ setScaleMode: function(scaleMode) {
835
+ if (settings.getScaleMode() !== scaleMode) {
836
+ settings.setScaleMode(scaleMode);
837
+ controller.scaleModeChanged(scaleMode);
838
+ }
839
+ return controller;
840
+ },
841
+ getViewMode: function() {
842
+ return viewMode;
843
+ },
844
+ setViewMode: function(vm) {
845
+ if (viewMode !== vm) {
846
+ viewMode = vm;
847
+ controller.viewModeChanged(vm);
848
+ if (report) {
849
+ controller.refreshReportCore(false, reportDocumentId);
850
+ }
851
+ }
852
+ return controller;
853
+ },
854
+ getPageMode: function() {
855
+ return pageMode;
856
+ },
857
+ setPageMode: function(psm) {
858
+ if (pageMode !== psm) {
859
+ pageMode = psm;
860
+ controller.pageModeChanged(psm);
861
+ if (report) {
862
+ controller.refreshReportCore(false, reportDocumentId);
863
+ }
864
+ }
865
+ return controller;
866
+ },
867
+ getPrintMode: function() {
868
+ return printMode;
869
+ },
870
+ setPrintMode: function(pm) {
871
+ if (printMode !== pm) {
872
+ printMode = pm;
873
+ controller.printModeChanged(pm);
874
+ }
875
+ return controller;
876
+ },
877
+ previewReport: function(ignoreCache, baseDocumentId, actionId) {
878
+ controller.loadedReportChange();
879
+ controller.refreshReportCore(ignoreCache, baseDocumentId, actionId);
880
+ },
881
+ refreshReportCore: function(ignoreCache, baseDocumentId, actionId) {
882
+ loadReportAsync(ignoreCache, baseDocumentId, actionId);
883
+ },
884
+ stopRendering: function() {
885
+ throwIfNoReport();
886
+ throwIfNoReportInstance();
887
+ throwIfNoReportDocument();
888
+ client.deleteReportDocument(clientId, reportInstanceId, reportDocumentId).catch(handleRequestError).then(function() {
889
+ if (loader) {
890
+ loader.cancel();
891
+ }
892
+ resetPageNumbers();
893
+ controller.renderingStopped();
894
+ });
895
+ },
896
+ getReportParameters: function() {
897
+ var paramsToBeExposed = {};
898
+ for (var key in processedParameterValues) {
899
+ var processedParam = processedParameterValues[key];
900
+ var paramValue = parameterValues[key];
901
+ if (processedParam && processedParam.availableValues) {
902
+ if (processedParam.multivalue) {
903
+ paramsToBeExposed[key] = addMultiComboParam(processedParam, paramValue, key);
904
+ } else {
905
+ paramsToBeExposed[key] = addSingleComboParam(processedParam, paramValue, key);
906
+ }
907
+ } else {
908
+ paramsToBeExposed[key] = paramValue;
909
+ }
910
+ }
911
+ return paramsToBeExposed;
912
+ },
913
+ refreshReport: function(ignoreCache, baseDocumentId, actionId) {
914
+ controller.loadedReportChange();
915
+ if (clientHasExpired) {
916
+ clientHasExpired = false;
917
+ clearClientId();
918
+ }
919
+ if (!report) {
920
+ controller.raiseError(stringResources.noReport);
921
+ return;
922
+ }
923
+ var loadParametersPromise = controller.loadParameters(null);
924
+ loadParametersPromise.then(function(parameters) {
925
+ var parameterValues2 = {};
926
+ var invalidParameters = [];
927
+ var hasError = false;
928
+ each(parameters || [], function() {
929
+ try {
930
+ var value = parameterValidators.validate(this, this.value);
931
+ parameterValues2[this.id] = value;
932
+ } catch (e) {
933
+ hasError = true;
934
+ invalidParameters.push(this);
935
+ return;
936
+ }
937
+ });
938
+ if (hasError) {
939
+ controller.raiseError(stringResources.missingOrInvalidParameter);
940
+ appendInvalidReportParameterNames(invalidParameters);
941
+ controller.missingOrInvalidParameters();
942
+ } else {
943
+ controller.setParameters(parameterValues2);
944
+ controller.refreshReportCore(ignoreCache, baseDocumentId, actionId);
945
+ }
946
+ });
947
+ controller.reloadParameters(loadParametersPromise);
948
+ },
949
+ exportReport: function(format, deviceInfo) {
950
+ exportReport(format, deviceInfo);
951
+ },
952
+ sendReport: function(args) {
953
+ sendReport(args);
954
+ },
955
+ printReport: function() {
956
+ printReport();
957
+ },
958
+ getReportPage: function(pageNumber) {
959
+ getReportPage(pageNumber);
960
+ },
961
+ executeReportAction: function(interactiveActionArgs) {
962
+ executeReportAction(interactiveActionArgs);
963
+ },
964
+ reportActionEnter: function(args) {
965
+ onReportActionEnter(args);
966
+ },
967
+ reportActionLeave: function(args) {
968
+ onReportActionLeave(args);
969
+ },
970
+ reportToolTipOpening: function(args) {
971
+ onReportToolTipOpening(args);
972
+ },
973
+ loadParameters: function(paramValues) {
974
+ if (report === null) {
975
+ return {};
976
+ }
977
+ controller.beforeLoadParameters(paramValues === null);
978
+ return loadParametersAsync(report, paramValues);
979
+ },
980
+ getDocumentFormats: function() {
981
+ return getDocumentFormatsAsync();
982
+ },
983
+ getServiceVersion: function() {
984
+ return getServiceVersionAsync();
985
+ },
986
+ setAuthenticationToken: function(token) {
987
+ client.setAccessToken(token);
988
+ },
989
+ clientId: function() {
990
+ return clientId;
991
+ },
992
+ onReportLoadComplete: function(info) {
993
+ pageCount = info.pageCount;
994
+ bookmarkNodes = info.bookmarkNodes;
995
+ renderingExtensions = info.renderingExtensions;
996
+ setStateReportSource(controller.getReportSource());
997
+ controller.reportLoadComplete(info);
998
+ },
999
+ raiseError: function(...args) {
1000
+ var errorMessage = formatError(args);
1001
+ controller.error(errorMessage);
1002
+ },
1003
+ getSearchResults: function(args, results) {
1004
+ return getSearchResultsAsync(args);
1005
+ },
1006
+ // --- E V E N T S ---
1007
+ on: function(eventName, handler) {
1008
+ eventEmitter.on(eventName, handler);
1009
+ return controller;
1010
+ },
1011
+ trigger: function(eventName, args) {
1012
+ eventEmitter.trigger(eventName, args);
1013
+ return controller;
1014
+ },
1015
+ showNotification: function(...args) {
1016
+ return eventFactory(controller.Events.SHOW_NOTIFICATION, args);
1017
+ },
1018
+ hideNotification: function(...args) {
1019
+ return eventFactory(controller.Events.HIDE_NOTIFICATION, args);
1020
+ },
1021
+ setUIState: function(...args) {
1022
+ return eventFactory(controller.Events.UI_STATE, args);
1023
+ },
1024
+ error: function(...args) {
1025
+ return eventFactory(controller.Events.ERROR, args);
1026
+ },
1027
+ reloadParameters: function(...args) {
1028
+ return eventFactory(controller.Events.RELOAD_PARAMETERS, args);
1029
+ },
1030
+ exportStarted: function(...args) {
1031
+ return eventFactory(controller.Events.EXPORT_STARTED, args);
1032
+ },
1033
+ exportReady: function(...args) {
1034
+ return eventFactory(controller.Events.EXPORT_DOCUMENT_READY, args);
1035
+ },
1036
+ sendEmailStarted: function(...args) {
1037
+ return eventFactory(controller.Events.SEND_EMAIL_STARTED, args);
1038
+ },
1039
+ sendEmailReady: function(...args) {
1040
+ return eventFactory(controller.Events.SEND_EMAIL_READY, args);
1041
+ },
1042
+ printStarted: function(...args) {
1043
+ return eventFactory(controller.Events.PRINT_STARTED, args);
1044
+ },
1045
+ printReady: function(...args) {
1046
+ return eventFactory(controller.Events.PRINT_DOCUMENT_READY, args);
1047
+ },
1048
+ beforeLoadParameters: function(...args) {
1049
+ return eventFactory(controller.Events.BEFORE_LOAD_PARAMETERS, args);
1050
+ },
1051
+ loadedReportChange: function(...args) {
1052
+ return eventFactory(controller.Events.LOADED_REPORT_CHANGE, args);
1053
+ },
1054
+ beforeLoadReport: function(...args) {
1055
+ return eventFactory(controller.Events.BEFORE_LOAD_REPORT, args);
1056
+ },
1057
+ beginLoadReport: function(...args) {
1058
+ return eventFactory(controller.Events.BEGIN_LOAD_REPORT, args);
1059
+ },
1060
+ reportLoadComplete: function(...args) {
1061
+ return eventFactory(controller.Events.REPORT_LOAD_COMPLETE, args);
1062
+ },
1063
+ reportLoadProgress: function(...args) {
1064
+ return eventFactory(controller.Events.REPORT_LOAD_PROGRESS, args);
1065
+ },
1066
+ reportLoadFail: function(...args) {
1067
+ return eventFactory(controller.Events.REPORT_LOAD_FAIL, args);
1068
+ },
1069
+ beginLoadPage: function(...args) {
1070
+ return eventFactory(controller.Events.BEGIN_LOAD_PAGE, args);
1071
+ },
1072
+ pageReady: function(...args) {
1073
+ return eventFactory(controller.Events.PAGE_READY, args);
1074
+ },
1075
+ viewModeChanged: function(...args) {
1076
+ return eventFactory(controller.Events.VIEW_MODE_CHANGED, args);
1077
+ },
1078
+ pageModeChanged: function(...args) {
1079
+ return eventFactory(controller.Events.PAGE_MODE_CHANGED, args);
1080
+ },
1081
+ printModeChanged: function(...args) {
1082
+ return eventFactory(controller.Events.PRINT_MODE_CHANGED, args);
1083
+ },
1084
+ reportSourceChanged: function(...args) {
1085
+ return eventFactory(controller.Events.REPORT_SOURCE_CHANGED, args);
1086
+ },
1087
+ navigateToPage: function(...args) {
1088
+ return eventFactory(controller.Events.NAVIGATE_TO_PAGE, args);
1089
+ },
1090
+ currentPageChanged: function(...args) {
1091
+ return eventFactory(controller.Events.CURRENT_PAGE_CHANGED, args);
1092
+ },
1093
+ getDocumentMapState: function(...args) {
1094
+ return eventFactory(controller.Events.GET_DOCUMENT_MAP_STATE, args);
1095
+ },
1096
+ setDocumentMapVisible: function(...args) {
1097
+ return eventFactory(controller.Events.SET_DOCUMENT_MAP_VISIBLE, args);
1098
+ },
1099
+ getParametersAreaState: function(...args) {
1100
+ return eventFactory(controller.Events.GET_PARAMETER_AREA_STATE, args);
1101
+ },
1102
+ setParametersAreaVisible: function(...args) {
1103
+ return eventFactory(controller.Events.SET_PARAMETER_AREA_VISIBLE, args);
1104
+ },
1105
+ setSideMenuVisible: function(...args) {
1106
+ return eventFactory(controller.Events.SET_TOGGLE_SIDE_MENU, args);
1107
+ },
1108
+ getSideMenuVisible: function(...args) {
1109
+ return eventFactory(controller.Events.GET_TOGGLE_SIDE_MENU, args);
1110
+ },
1111
+ scaleChanged: function(...args) {
1112
+ return eventFactory(controller.Events.SCALE_CHANGED, args);
1113
+ },
1114
+ scaleModeChanged: function(...args) {
1115
+ return eventFactory(controller.Events.SCALE_MODE_CHANGED, args);
1116
+ },
1117
+ serverActionStarted: function(...args) {
1118
+ return eventFactory(controller.Events.SERVER_ACTION_STARTED, args);
1119
+ },
1120
+ cssLoaded: function(...args) {
1121
+ return eventFactory(controller.Events.CSS_LOADED, args);
1122
+ },
1123
+ interactiveActionExecuting: function(...args) {
1124
+ return eventFactory(controller.Events.INTERACTIVE_ACTION_EXECUTING, args);
1125
+ },
1126
+ interactiveActionEnter: function(...args) {
1127
+ return eventFactory(controller.Events.INTERACTIVE_ACTION_ENTER, args);
1128
+ },
1129
+ interactiveActionLeave: function(...args) {
1130
+ return eventFactory(controller.Events.INTERACTIVE_ACTION_LEAVE, args);
1131
+ },
1132
+ updateUI: function(...args) {
1133
+ return eventFactory(controller.Events.UPDATE_UI, args);
1134
+ },
1135
+ updateUIInternal: function(...args) {
1136
+ return eventFactory(controller.Events.UPDATE_UI_INTERNAL, args);
1137
+ },
1138
+ toolTipOpening: function(...args) {
1139
+ return eventFactory(controller.Events.TOOLTIP_OPENING, args);
1140
+ },
1141
+ pageNumberChange: function(...args) {
1142
+ return eventFactory(controller.Events.PAGE_NUMBER, args);
1143
+ },
1144
+ pageCountChange: function(...args) {
1145
+ return eventFactory(controller.Events.PAGE_COUNT, args);
1146
+ },
1147
+ getSearchDialogState: function(...args) {
1148
+ return eventFactory(controller.Events.GET_SEARCH_DIALOG_STATE, args);
1149
+ },
1150
+ getSendEmailDialogState: function(...args) {
1151
+ return eventFactory(controller.Events.GET_SEND_EMAIL_DIALOG_STATE, args);
1152
+ },
1153
+ setSearchDialogVisible: function(...args) {
1154
+ return eventFactory(controller.Events.SET_SEARCH_DIALOG_VISIBLE, args);
1155
+ },
1156
+ setSendEmailDialogVisible: function(...args) {
1157
+ return eventFactory(controller.Events.SET_SEND_EMAIL_DIALOG_VISIBLE, args);
1158
+ },
1159
+ scrollPageReady: function(...args) {
1160
+ return eventFactory(controller.Events.SCROLL_PAGE_READY, args);
1161
+ },
1162
+ updatePageDimensionsReady: function(...args) {
1163
+ return eventFactory(controller.Events.UPDATE_SCROLL_PAGE_DIMENSIONS_READY, args);
1164
+ },
1165
+ missingOrInvalidParameters: function(...args) {
1166
+ return eventFactory(controller.Events.MISSING_OR_INVALID_PARAMETERS, args);
1167
+ },
1168
+ renderingStopped: function(...args) {
1169
+ return eventFactory(controller.Events.RENDERING_STOPPED, args);
1170
+ },
1171
+ clientExpired: function(...args) {
1172
+ return eventFactory(controller.Events.CLIENT_EXPIRED, args);
1173
+ },
1174
+ dispose: function() {
1175
+ stopSentinel();
1176
+ this.serviceClientSentinel = null;
1177
+ }
1178
+ }
1179
+ );
1180
+ return controller;
1181
+ }
1182
+ function addSingleComboParam(processedParam, paramValue, key) {
1183
+ try {
1184
+ var nameValuePair = processedParam.availableValues.find((obj) => {
1185
+ return obj["value"] === paramValue;
1186
+ });
1187
+ if (!nameValuePair) {
1188
+ throw new Error(`The available values of parameter ${key} do not contain Value property that equals ${paramValue}`);
1189
+ }
1190
+ return { valueMember: paramValue, displayMember: nameValuePair["name"] };
1191
+ } catch (e) {
1192
+ logError(e);
1193
+ }
1194
+ }
1195
+ function addMultiComboParam(processedParam, paramValue, key) {
1196
+ var paramArr = [];
1197
+ for (var i in paramValue) {
1198
+ paramArr.push(addSingleComboParam(processedParam, paramValue[i], key));
1199
+ }
1200
+ return paramArr;
1201
+ }
1202
+
1203
+ export { ReportViewerController };