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