@progress/telerik-jquery-report-viewer 21.24.305 → 22.24.514

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/accessibility.js +218 -0
  3. package/dist/cjs/binder.js +172 -0
  4. package/dist/cjs/command.js +32 -0
  5. package/dist/cjs/commandSet.js +167 -0
  6. package/dist/cjs/controller.js +1207 -0
  7. package/dist/cjs/documentMapArea.js +168 -0
  8. package/dist/cjs/domUtils.js +50 -0
  9. package/dist/cjs/enums.js +52 -0
  10. package/dist/cjs/event-emitter.js +17 -0
  11. package/dist/cjs/events.js +23 -0
  12. package/dist/cjs/globalSettings.js +9 -0
  13. package/dist/cjs/history.js +131 -0
  14. package/dist/cjs/index.js +58 -0
  15. package/dist/cjs/jqueryThrottleDebounce.js +48 -0
  16. package/dist/cjs/kendo-jquery.js +4 -0
  17. package/dist/cjs/mainMenu.js +332 -0
  18. package/dist/cjs/mem-storage.js +44 -0
  19. package/dist/cjs/pagesArea.js +641 -0
  20. package/dist/cjs/parameterValidators.js +167 -0
  21. package/dist/cjs/parameters.js +921 -0
  22. package/dist/cjs/parametersArea.js +502 -0
  23. package/dist/cjs/perspectives.js +138 -0
  24. package/dist/cjs/print.js +166 -0
  25. package/dist/cjs/report-viewer/report-viewer-settings.js +138 -0
  26. package/dist/cjs/reportViewer.js +654 -0
  27. package/dist/cjs/scroll.js +537 -0
  28. package/dist/cjs/search.js +634 -0
  29. package/dist/cjs/sendEmail.js +435 -0
  30. package/dist/cjs/service-client-sentinel.js +52 -0
  31. package/dist/cjs/serviceClient.js +405 -0
  32. package/dist/cjs/sideMenu.js +225 -0
  33. package/dist/cjs/sr.js +164 -0
  34. package/dist/cjs/stringResources.js +11 -0
  35. package/dist/cjs/telerikReportViewer.kendo.js +60196 -0
  36. package/dist/cjs/telerikReportViewer.kendo.min.js +19776 -0
  37. package/dist/cjs/template-cache.js +39 -0
  38. package/dist/cjs/touch.js +86 -0
  39. package/dist/cjs/uiController.js +142 -0
  40. package/dist/cjs/uiFreezeCoordinator.js +281 -0
  41. package/dist/cjs/utils.js +492 -0
  42. package/dist/es/accessibility.js +214 -0
  43. package/dist/es/binder.js +168 -0
  44. package/dist/es/command.js +28 -0
  45. package/dist/es/commandSet.js +163 -0
  46. package/dist/es/controller.js +1203 -0
  47. package/dist/es/documentMapArea.js +164 -0
  48. package/dist/es/domUtils.js +43 -0
  49. package/dist/es/enums.js +41 -0
  50. package/dist/es/event-emitter.js +13 -0
  51. package/dist/es/events.js +19 -0
  52. package/dist/es/globalSettings.js +5 -0
  53. package/dist/es/history.js +127 -0
  54. package/dist/es/index.js +24 -0
  55. package/dist/es/jqueryThrottleDebounce.js +46 -0
  56. package/dist/es/kendo-jquery.js +1 -0
  57. package/dist/es/mainMenu.js +328 -0
  58. package/dist/es/mem-storage.js +40 -0
  59. package/dist/es/pagesArea.js +637 -0
  60. package/dist/es/parameterValidators.js +163 -0
  61. package/dist/es/parameters.js +916 -0
  62. package/dist/es/parametersArea.js +498 -0
  63. package/dist/es/perspectives.js +134 -0
  64. package/dist/es/print.js +162 -0
  65. package/dist/es/report-viewer/report-viewer-settings.js +134 -0
  66. package/dist/es/reportViewer.js +650 -0
  67. package/dist/es/scroll.js +533 -0
  68. package/dist/es/search.js +630 -0
  69. package/dist/es/sendEmail.js +431 -0
  70. package/dist/es/service-client-sentinel.js +48 -0
  71. package/dist/es/serviceClient.js +401 -0
  72. package/dist/es/sideMenu.js +221 -0
  73. package/dist/es/sr.js +162 -0
  74. package/dist/es/stringResources.js +7 -0
  75. package/dist/es/telerikReportViewer.kendo.js +60194 -0
  76. package/dist/es/telerikReportViewer.kendo.min.js +19774 -0
  77. package/dist/es/template-cache.js +35 -0
  78. package/dist/es/touch.js +82 -0
  79. package/dist/es/uiController.js +138 -0
  80. package/dist/es/uiFreezeCoordinator.js +277 -0
  81. package/dist/es/utils.js +447 -0
  82. package/dist/font/font-icons.css +4 -4
  83. package/dist/font/font-icons.min.css +3 -3
  84. package/dist/js/telerikReportViewer.js +8562 -8606
  85. package/dist/js/telerikReportViewer.min.js +1 -17
  86. package/dist/js/telerikReportViewer.stringResources.js +166 -173
  87. package/dist/styles/telerikReportViewer.css +1 -1
  88. package/dist/styles/telerikReportViewer.min.css +1 -1
  89. package/dist/templates/telerikReportViewerTemplate-FA.html +3 -3
  90. package/dist/templates/telerikReportViewerTemplate.html +3 -3
  91. package/package.json +13 -7
  92. /package/dist/font/{ReportingIcons-18.0.24.305.ttf → ReportingIcons-18.1.24.514.ttf} +0 -0
@@ -0,0 +1,502 @@
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 parameterValidators = require('./parameterValidators.js');
8
+ var parameters = require('./parameters.js');
9
+ var enums = require('./enums.js');
10
+ var globalSettings = require('./globalSettings.js');
11
+
12
+ var defaultOptions = {};
13
+ var Events = {
14
+ PARAMETERS_READY: "pa.parametersReady",
15
+ ERROR: "pa.Error"
16
+ };
17
+ function ParametersArea(placeholder, options, otherOptions) {
18
+ options = $.extend({}, defaultOptions, options, otherOptions);
19
+ var parametersArea = {};
20
+ var $parametersArea = $(parametersArea);
21
+ var editors = {};
22
+ var controller = options.controller;
23
+ if (!controller) {
24
+ throw "No controller (telerikReporting.reportViewerController) has been specified.";
25
+ }
26
+ var parameterEditors = [].concat(options.parameterEditors, parameters.ParameterEditors);
27
+ var recentParameterValues;
28
+ var parameters$1;
29
+ var initialParameterValues;
30
+ var processedParameterValues = void 0;
31
+ var $placeholder = $(placeholder);
32
+ var $content = $placeholder.find(".trv-parameters-area-content");
33
+ var $errorMessage = $placeholder.find(".trv-error-message");
34
+ var $previewButton = $placeholder.find(".trv-parameters-area-preview-button");
35
+ $previewButton.text(stringResources.stringResources[$previewButton.text()]);
36
+ $previewButton.attr("aria-label", stringResources.stringResources[$previewButton.attr("aria-label")]);
37
+ $previewButton.on("click", function(e) {
38
+ e.preventDefault();
39
+ if (allParametersValid()) {
40
+ applyParameters();
41
+ }
42
+ });
43
+ var parameterContainerTemplate = options.templates["trv-parameter"];
44
+ var parametersAreaVisible = options.parametersAreaVisible !== false;
45
+ var enableAccessibility = options.enableAccessibility;
46
+ init();
47
+ function init() {
48
+ replaceStringResources($placeholder);
49
+ }
50
+ function replaceStringResources($paramsArea) {
51
+ var $previewButton2 = $paramsArea.find(".trv-parameters-area-preview-button");
52
+ if (!$previewButton2) {
53
+ return;
54
+ }
55
+ $previewButton2.attr("aria-label", stringResources.stringResources[$previewButton2.attr("aria-label")]);
56
+ $previewButton2.text(stringResources.stringResources[$previewButton2.text()]);
57
+ }
58
+ function toggleElementDisplay(el, shouldHide) {
59
+ el.style.display = shouldHide ? "none" : "";
60
+ }
61
+ function createParameterContainer() {
62
+ return $(parameterContainerTemplate);
63
+ }
64
+ function createParameterUI(parameter) {
65
+ var $container = createParameterContainer();
66
+ var $editorPlaceholder = $container.find(".trv-parameter-value");
67
+ var $title = $container.find(".trv-parameter-title");
68
+ var $error = $container.find(".trv-parameter-error");
69
+ var $errorMessage2 = $container.find(".trv-parameter-error-message");
70
+ var $useDefaultValueCheckbox = $container.find(".trv-parameter-use-default input");
71
+ var editorsTypes = options.parameters && options.parameters.editors ? options.parameters.editors : null;
72
+ var editorFactory = selectParameterEditorFactory(parameter, editorsTypes);
73
+ var parameterText = utils.escapeHtml(parameter.text);
74
+ var isHiddenParameter = !parameter.isVisible;
75
+ if (isHiddenParameter) {
76
+ parameterText += " [<b>hidden</b>]";
77
+ }
78
+ $title.html(parameterText).attr("title", parameterText);
79
+ $errorMessage2.text(parameter.Error);
80
+ (parameter.Error ? $.fn.show : $.fn.hide).call($error);
81
+ var editor = editorFactory.createEditor(
82
+ $editorPlaceholder,
83
+ {
84
+ templates: options.templates,
85
+ parameterChanged: function(parameter2, newValue) {
86
+ var invalidParameterLI = document.querySelector(".trv-pages-area .trv-error-message ul li." + parameter2.name);
87
+ try {
88
+ newValue = parameterValidators.ParameterValidators.validate(parameter2, newValue);
89
+ $error.hide();
90
+ if (invalidParameterLI) {
91
+ toggleElementDisplay(invalidParameterLI, true);
92
+ }
93
+ onParameterChanged(parameter2, newValue);
94
+ } catch (error) {
95
+ if (invalidParameterLI) {
96
+ toggleElementDisplay(invalidParameterLI, false);
97
+ }
98
+ parameter2.Error = error;
99
+ parameter2.value = [];
100
+ $errorMessage2.text(error);
101
+ $error.show();
102
+ enablePreviewButton(false);
103
+ } finally {
104
+ setAccessibilityErrorState(parameter2);
105
+ }
106
+ },
107
+ enableAccessibility
108
+ }
109
+ );
110
+ editors[parameter.id] = editor;
111
+ editor.beginEdit(parameter);
112
+ if (enableAccessibility && !isHiddenParameter) {
113
+ editor.addAccessibility(parameter);
114
+ }
115
+ if ($useDefaultValueCheckbox.length > 0) {
116
+ $useDefaultValueCheckbox.on(
117
+ "click",
118
+ function() {
119
+ var useDefaultValue = $(this).is(":checked");
120
+ if (useDefaultValue) {
121
+ delete recentParameterValues[parameter.id];
122
+ delete initialParameterValues[parameter.id];
123
+ invalidateChildParameters(parameter);
124
+ updateParameters(onLoadParametersSuccess);
125
+ } else {
126
+ recentParameterValues[parameter.id] = parameter.value;
127
+ initialParameterValues[parameter.id] = parameter.value;
128
+ }
129
+ editor.enable(!useDefaultValue);
130
+ raiseParametersReady();
131
+ }
132
+ );
133
+ var hasInitialValues = initialParameterValues !== null;
134
+ if (hasInitialValues) {
135
+ if (!(parameter.id in initialParameterValues)) {
136
+ $useDefaultValueCheckbox.prop("checked", true);
137
+ editor.enable(false);
138
+ }
139
+ } else if (isHiddenParameter) {
140
+ $useDefaultValueCheckbox.prop("checked", true);
141
+ editor.enable(false);
142
+ }
143
+ }
144
+ return $container;
145
+ }
146
+ function setAccessibilityErrorState(parameter) {
147
+ var editor = editors[parameter.id];
148
+ if (!editor || !enableAccessibility) {
149
+ return;
150
+ }
151
+ editor.setAccessibilityErrorState(parameter);
152
+ }
153
+ function enablePreviewButton(enabled) {
154
+ if (enabled) {
155
+ $previewButton.prop("disabled", false);
156
+ $previewButton.removeClass("k-disabled");
157
+ } else {
158
+ $previewButton.prop("disabled", true);
159
+ $previewButton.addClass("k-disabled");
160
+ }
161
+ }
162
+ function selectParameterEditorFactory(parameter, editorsType) {
163
+ var factory;
164
+ utils.each(parameterEditors, function() {
165
+ if (this && this.match(parameter, editorsType)) {
166
+ factory = this;
167
+ }
168
+ return !factory;
169
+ });
170
+ return factory;
171
+ }
172
+ function showError(error) {
173
+ $errorMessage.text(error);
174
+ (error ? $.fn.addClass : $.fn.removeClass).call($placeholder, "trv-error");
175
+ }
176
+ function showPreviewButton() {
177
+ (allParametersAutoRefresh() ? $.fn.removeClass : $.fn.addClass).call($placeholder, "preview");
178
+ }
179
+ function allParametersAutoRefresh() {
180
+ var allAuto = true;
181
+ utils.each(parameters$1, function() {
182
+ return allAuto = !this.isVisible || this.autoRefresh;
183
+ });
184
+ return allAuto;
185
+ }
186
+ function allParametersValid() {
187
+ var allValid = true;
188
+ utils.each(parameters$1, function() {
189
+ return allValid = !this.Error;
190
+ });
191
+ return allValid;
192
+ }
193
+ function clearEditors() {
194
+ utils.each(editors, function() {
195
+ if (this.hasOwnProperty("destroy")) {
196
+ this.destroy();
197
+ }
198
+ });
199
+ editors = {};
200
+ }
201
+ function fill(newParameters) {
202
+ recentParameterValues = {};
203
+ processedParameterValues = {};
204
+ parameters$1 = newParameters || [];
205
+ clearEditors();
206
+ var $parameterContainer;
207
+ var $tempContainer = $("<div></div>");
208
+ utils.each(parameters$1, function() {
209
+ try {
210
+ this.value = parameterValidators.ParameterValidators.validate(this, this.value);
211
+ } catch (e) {
212
+ this.Error = this.Error || e;
213
+ }
214
+ var hasError = Boolean(this.Error);
215
+ var hasValue = !hasError;
216
+ if (hasValue) {
217
+ recentParameterValues[this.id] = this.value;
218
+ if (this.availableValues) {
219
+ processedParameterValues[this.id] = { valueMember: this.value, displayMember: this.label, availableValues: this.availableValues, multivalue: this.multivalue };
220
+ } else {
221
+ processedParameterValues[this.id] = this.value;
222
+ }
223
+ } else {
224
+ this.Error = stringResources.stringResources.invalidParameter;
225
+ }
226
+ if (this.isVisible || options.showHiddenParameters) {
227
+ $parameterContainer = createParameterUI(this);
228
+ if ($parameterContainer) {
229
+ $tempContainer.append($parameterContainer);
230
+ }
231
+ }
232
+ });
233
+ if (initialParameterValues !== void 0) {
234
+ if (null === initialParameterValues) {
235
+ initialParameterValues = {};
236
+ utils.each(parameters$1, function() {
237
+ if (this.isVisible) {
238
+ initialParameterValues[this.id] = this.value;
239
+ } else {
240
+ delete recentParameterValues[this.id];
241
+ }
242
+ });
243
+ } else {
244
+ utils.each(parameters$1, function() {
245
+ if (!(this.id in initialParameterValues)) {
246
+ delete recentParameterValues[this.id];
247
+ }
248
+ });
249
+ }
250
+ }
251
+ $content.empty();
252
+ if (parameters$1.length > 0) {
253
+ $content.append($tempContainer.children());
254
+ if (enableAccessibility) {
255
+ $content.attr("aria-label", "Parameters area. Contains " + parameters$1.length + " parameters.");
256
+ }
257
+ }
258
+ showPreviewButton();
259
+ var allValid = allParametersValid();
260
+ enablePreviewButton(allValid);
261
+ applyProcessedParameters();
262
+ }
263
+ function applyParameters() {
264
+ controller.setParameters($.extend({}, recentParameterValues));
265
+ controller.previewReport(false);
266
+ }
267
+ function applyProcessedParameters() {
268
+ controller.setProcessedParameter($.extend({}, processedParameterValues));
269
+ }
270
+ function allParametersValidForAutoRefresh() {
271
+ var triggerAutoUpdate = true;
272
+ for (var i = parameters$1.length - 1; triggerAutoUpdate && i >= 0; i--) {
273
+ var p = parameters$1[i];
274
+ triggerAutoUpdate = p.id in recentParameterValues && (Boolean(p.autoRefresh) || !p.isVisible);
275
+ }
276
+ return triggerAutoUpdate;
277
+ }
278
+ function raiseParametersReady() {
279
+ parametersArea.parametersReady(recentParameterValues);
280
+ }
281
+ function tryRefreshReport() {
282
+ raiseParametersReady();
283
+ if (allParametersValidForAutoRefresh()) {
284
+ applyParameters();
285
+ }
286
+ }
287
+ function invalidateChildParameters(parameter) {
288
+ if (parameter.childParameters) {
289
+ utils.each(parameter.childParameters, function(index, parameterId) {
290
+ var childParameter = getParameterById(parameterId);
291
+ if (childParameter) {
292
+ invalidateChildParameters(childParameter);
293
+ }
294
+ delete recentParameterValues[parameterId];
295
+ resetPendingParameterChange(parameterId);
296
+ });
297
+ }
298
+ }
299
+ function resetPendingParameterChange(parameterId) {
300
+ if (editors) {
301
+ var editor = editors[parameterId];
302
+ if (editor && typeof editor.clearPendingChange === "function") {
303
+ editor.clearPendingChange();
304
+ }
305
+ }
306
+ }
307
+ function onParameterChanged(parameter, newValue) {
308
+ delete parameter["Error"];
309
+ parameter.value = newValue;
310
+ recentParameterValues[parameter.id] = newValue;
311
+ if (initialParameterValues !== void 0) {
312
+ if (parameter.id in initialParameterValues) {
313
+ recentParameterValues[parameter.id] = newValue;
314
+ }
315
+ } else {
316
+ recentParameterValues[parameter.id] = newValue;
317
+ }
318
+ invalidateChildParameters(parameter);
319
+ if (parameter.childParameters) {
320
+ updateParameters(tryRefreshReport);
321
+ } else {
322
+ var allValid = allParametersValid();
323
+ enablePreviewButton(allValid);
324
+ if (allValid) {
325
+ var errorMsg = document.querySelector(".trv-pages-area .trv-error-message");
326
+ if ($previewButton.is(":visible") && errorMsg) {
327
+ errorMsg.textContent = stringResources.stringResources.tryReportPreview;
328
+ }
329
+ tryRefreshReport();
330
+ }
331
+ }
332
+ }
333
+ function getParameterById(parameterId) {
334
+ if (parameters$1) {
335
+ for (var i = 0; i < parameters$1.length; i++) {
336
+ var p = parameters$1[i];
337
+ if (p.id === parameterId) {
338
+ return p;
339
+ }
340
+ }
341
+ }
342
+ return null;
343
+ }
344
+ function hasVisibleParameters(params) {
345
+ if (!params || null === params) {
346
+ return false;
347
+ }
348
+ var result = false;
349
+ utils.each(params, function() {
350
+ result = this.isVisible;
351
+ return !result;
352
+ });
353
+ return result;
354
+ }
355
+ var loadingCount = 0;
356
+ function beginLoad() {
357
+ loadingCount++;
358
+ $placeholder.addClass("trv-loading");
359
+ }
360
+ function endLoad() {
361
+ if (loadingCount > 0) {
362
+ if (0 === --loadingCount) {
363
+ $placeholder.removeClass("trv-loading");
364
+ }
365
+ }
366
+ }
367
+ var parametersAreaNecessary = false;
368
+ function onLoadParametersComplete(params, successAction) {
369
+ parametersAreaNecessary = hasVisibleParameters(params);
370
+ if (!parametersAreaNecessary) {
371
+ showParametersArea(false);
372
+ }
373
+ fill(params);
374
+ showError("");
375
+ if (parametersAreaNecessary && parametersAreaVisible) {
376
+ showParametersArea(true);
377
+ if (enableAccessibility) {
378
+ setSplitbarAccessibilityAttributes();
379
+ }
380
+ }
381
+ controller.updateUIInternal();
382
+ if (typeof successAction === "function") {
383
+ successAction();
384
+ }
385
+ endLoad();
386
+ }
387
+ function updateParameters(successAction) {
388
+ acceptParameters(controller.loadParameters(recentParameterValues), successAction);
389
+ }
390
+ function acceptParameters(controllerLoadParametersPromise, successAction) {
391
+ beginLoad();
392
+ controllerLoadParametersPromise.then(function(parameters2) {
393
+ onLoadParametersComplete(parameters2, successAction);
394
+ }).catch(function(error) {
395
+ endLoad();
396
+ clear();
397
+ if (!$placeholder.hasClass("trv-hidden")) {
398
+ showError(error);
399
+ }
400
+ parametersArea.error(error);
401
+ });
402
+ }
403
+ function getEventHandlerFromArguments(args) {
404
+ var arg0;
405
+ if (args && args.length) {
406
+ arg0 = args[0];
407
+ }
408
+ if (typeof arg0 === "function") {
409
+ return arg0;
410
+ }
411
+ return null;
412
+ }
413
+ function eventFactory(event, args) {
414
+ var h = getEventHandlerFromArguments(args);
415
+ if (h) {
416
+ $parametersArea.on(event, h);
417
+ } else {
418
+ $parametersArea.trigger(event, args);
419
+ }
420
+ return controller;
421
+ }
422
+ function onLoadParametersSuccess() {
423
+ if (initialParameterValues === null) {
424
+ initialParameterValues = $.extend({}, recentParameterValues);
425
+ }
426
+ raiseParametersReady();
427
+ }
428
+ function showParametersArea(show) {
429
+ var splitter = globalSettings.GlobalSettings.viewerInstances.find((element) => element.id === options.viewerSelector + "-parameters-splitter").instance;
430
+ var sibling = $placeholder.prev();
431
+ if (options.parametersAreaPosition === enums.ParametersAreaPositions.TOP || options.parametersAreaPosition === enums.ParametersAreaPositions.LEFT) {
432
+ sibling = $placeholder.next();
433
+ }
434
+ if (splitter) {
435
+ (parametersAreaNecessary ? $.fn.removeClass : $.fn.addClass).call(sibling, "trv-hidden");
436
+ splitter.toggle(".trv-parameters-area", show);
437
+ }
438
+ }
439
+ function setSplitbarAccessibilityAttributes() {
440
+ var splitbar = $placeholder.prev();
441
+ var tabIndex = $placeholder.find(".trv-parameters-area-content").attr("tabIndex");
442
+ if (options.parametersAreaPosition === enums.ParametersAreaPositions.TOP || options.parametersAreaPosition === enums.ParametersAreaPositions.LEFT) {
443
+ splitbar = $placeholder.next();
444
+ }
445
+ splitbar.attr("aria-label", stringResources.stringResources.ariaLabelParametersAreaSplitter);
446
+ splitbar.attr("tabIndex", tabIndex);
447
+ }
448
+ function onReloadParameters(event, controllerLoadParametersPromise) {
449
+ showError();
450
+ $content.empty();
451
+ acceptParameters(controllerLoadParametersPromise, onLoadParametersSuccess);
452
+ }
453
+ controller.reloadParameters(onReloadParameters).beforeLoadReport(function() {
454
+ loadingCount = 0;
455
+ beginLoad();
456
+ }).error(endLoad).pageReady(endLoad);
457
+ controller.getParametersAreaState(function(event, args) {
458
+ var parametersAreaNecessary2 = false;
459
+ if (parameters$1) {
460
+ parametersAreaNecessary2 = hasVisibleParameters(parameters$1);
461
+ }
462
+ args.enabled = parametersAreaNecessary2;
463
+ args.visible = parametersAreaVisible;
464
+ }).setParametersAreaVisible(function(event, args) {
465
+ parametersAreaVisible = args.visible;
466
+ showParametersArea(args.visible && hasVisibleParameters(parameters$1));
467
+ });
468
+ function clear() {
469
+ fill([]);
470
+ }
471
+ $.extend(
472
+ parametersArea,
473
+ {
474
+ allParametersValid: function() {
475
+ return allParametersValid();
476
+ },
477
+ clear: function() {
478
+ clear();
479
+ },
480
+ error: function() {
481
+ return eventFactory(Events.ERROR, arguments);
482
+ },
483
+ parametersReady: function() {
484
+ return eventFactory(Events.PARAMETERS_READY, arguments);
485
+ },
486
+ setParameters: function(parameterValues) {
487
+ initialParameterValues = null === parameterValues ? null : $.extend({}, parameterValues);
488
+ }
489
+ }
490
+ );
491
+ return parametersArea;
492
+ }
493
+ var pluginName = "telerik_ReportViewer_ParametersArea";
494
+ $.fn[pluginName] = function(options, otherOptions) {
495
+ return utils.each(this, function() {
496
+ if (!$.data(this, pluginName)) {
497
+ $.data(this, pluginName, new ParametersArea(this, options, otherOptions));
498
+ }
499
+ });
500
+ };
501
+
502
+ exports.ParametersArea = ParametersArea;
@@ -0,0 +1,138 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function PerspectiveManager(dom, controller) {
6
+ var smallMenu = dom.querySelectorAll ? dom.querySelectorAll(".trv-menu-small")[0] : false;
7
+ var perspectives = {
8
+ "small": {
9
+ documentMapVisible: false,
10
+ parametersAreaVisible: false,
11
+ onDocumentMapVisibleChanged: function(e, args) {
12
+ if (args.visible) {
13
+ controller.setParametersAreaVisible({ visible: false });
14
+ }
15
+ },
16
+ onParameterAreaVisibleChanged: function(e, args) {
17
+ if (args.visible) {
18
+ controller.setDocumentMapVisible({ visible: false });
19
+ }
20
+ },
21
+ onBeforeLoadReport: function() {
22
+ controller.setParametersAreaVisible({ visible: false });
23
+ controller.setDocumentMapVisible({ visible: false });
24
+ },
25
+ onNavigateToPage: function() {
26
+ controller.setParametersAreaVisible({ visible: false });
27
+ controller.setDocumentMapVisible({ visible: false });
28
+ }
29
+ },
30
+ "large": {
31
+ documentMapVisible: true,
32
+ parametersAreaVisible: true
33
+ }
34
+ };
35
+ var currentPerspective;
36
+ function init() {
37
+ currentPerspective = getPerspective();
38
+ initStateFromController(perspectives["large"]);
39
+ }
40
+ function setPerspective(beforeApplyState) {
41
+ var perspective = getPerspective();
42
+ if (perspective !== currentPerspective) {
43
+ var oldState = perspectives[currentPerspective];
44
+ var newState = perspectives[perspective];
45
+ currentPerspective = perspective;
46
+ if (beforeApplyState) {
47
+ beforeApplyState.call(void 0, oldState, newState);
48
+ }
49
+ applyState(newState);
50
+ }
51
+ }
52
+ function onDocumentMapVisibleChanged(e, args) {
53
+ dispatch("onDocumentMapVisibleChanged", arguments);
54
+ }
55
+ function onParameterAreaVisibleChanged(e, args) {
56
+ dispatch("onParameterAreaVisibleChanged", arguments);
57
+ }
58
+ function onBeforeLoadReport() {
59
+ dispatch("onBeforeLoadReport", arguments);
60
+ }
61
+ function onNavigateToPage() {
62
+ dispatch("onNavigateToPage", arguments);
63
+ }
64
+ function onReportLoadComplete() {
65
+ dispatch("onReportLoadComplete", arguments);
66
+ }
67
+ function onWindowResize() {
68
+ setPerspective(
69
+ function(oldState, newState) {
70
+ initStateFromController(oldState);
71
+ }
72
+ );
73
+ }
74
+ function onCssLoaded() {
75
+ setPerspective(null);
76
+ }
77
+ function dispatch(func, args) {
78
+ var activePerspective = perspectives[currentPerspective];
79
+ var handler = activePerspective[func];
80
+ if (typeof handler === "function") {
81
+ handler.apply(activePerspective, args);
82
+ }
83
+ }
84
+ function attach() {
85
+ window.addEventListener("resize", onWindowResize);
86
+ controller.setDocumentMapVisible(onDocumentMapVisibleChanged);
87
+ controller.setParametersAreaVisible(onParameterAreaVisibleChanged);
88
+ controller.beforeLoadReport(onBeforeLoadReport);
89
+ controller.navigateToPage(onNavigateToPage);
90
+ controller.reportLoadComplete(onReportLoadComplete);
91
+ controller.cssLoaded(onCssLoaded);
92
+ }
93
+ function dispose() {
94
+ window.removeEventListener("resize", onWindowResize);
95
+ }
96
+ function getPerspective() {
97
+ var windowWidthInEm = $(window).width() / parseFloat($("body").css("font-size"));
98
+ var windowMinWidth = 40.5;
99
+ return smallMenu && windowWidthInEm <= windowMinWidth ? "small" : "large";
100
+ }
101
+ function initStateFromController(state) {
102
+ state.documentMapVisible = documentMapVisible();
103
+ state.parametersAreaVisible = parametersAreaVisible();
104
+ }
105
+ function applyState(state) {
106
+ documentMapVisible(state.documentMapVisible);
107
+ parametersAreaVisible(state.parametersAreaVisible);
108
+ }
109
+ function documentMapVisible() {
110
+ if (arguments.length === 0) {
111
+ var args1 = {};
112
+ controller.getDocumentMapState(args1);
113
+ return args1.visible;
114
+ }
115
+ controller.setDocumentMapVisible({
116
+ visible: Boolean(arguments[0])
117
+ });
118
+ return this;
119
+ }
120
+ function parametersAreaVisible() {
121
+ if (arguments.length === 0) {
122
+ var args1 = {};
123
+ controller.getParametersAreaState(args1);
124
+ return args1.visible;
125
+ }
126
+ controller.setParametersAreaVisible({
127
+ visible: Boolean(arguments[0])
128
+ });
129
+ return this;
130
+ }
131
+ init();
132
+ return {
133
+ attach,
134
+ dispose
135
+ };
136
+ }
137
+
138
+ exports.PerspectiveManager = PerspectiveManager;