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