@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,486 @@
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 = Array.from(parameterEditors).find((editor) => {
164
+ return editor.match(parameter, editorsType);
165
+ });
166
+ return factory;
167
+ }
168
+ function showError(error) {
169
+ $errorMessage.text(error);
170
+ (error ? $.fn.addClass : $.fn.removeClass).call($placeholder, "trv-error");
171
+ }
172
+ function showPreviewButton() {
173
+ (allParametersAutoRefresh() ? $.fn.removeClass : $.fn.addClass).call($placeholder, "preview");
174
+ }
175
+ function allParametersAutoRefresh() {
176
+ var allAuto = Array.from(parameters$1).every((parameter) => {
177
+ return !parameter.isVisible || parameter.autoRefresh;
178
+ });
179
+ return allAuto;
180
+ }
181
+ function allParametersValid() {
182
+ var allValid = Array.from(parameters$1).every((parameter) => {
183
+ return !parameter.Error;
184
+ });
185
+ return allValid;
186
+ }
187
+ function clearEditors() {
188
+ Object.entries(editors).forEach(([key, editor]) => {
189
+ if (typeof editor.destroy === "function") {
190
+ editor.destroy();
191
+ }
192
+ });
193
+ editors = {};
194
+ }
195
+ function fill(newParameters) {
196
+ recentParameterValues = {};
197
+ processedParameterValues = {};
198
+ parameters$1 = newParameters || [];
199
+ clearEditors();
200
+ var $parameterContainer;
201
+ var $tempContainer = $("<div></div>");
202
+ Array.from(parameters$1).forEach((parameter) => {
203
+ try {
204
+ parameter.value = parameterValidators.ParameterValidators.validate(parameter, parameter.value);
205
+ } catch (e) {
206
+ parameter.Error = parameter.Error || e;
207
+ }
208
+ var hasError = Boolean(parameter.Error);
209
+ var hasValue = !hasError;
210
+ if (hasValue) {
211
+ recentParameterValues[parameter.id] = parameter.value;
212
+ if (parameter.availableValues) {
213
+ processedParameterValues[parameter.id] = { valueMember: parameter.value, displayMember: parameter.label, availableValues: parameter.availableValues, multivalue: parameter.multivalue };
214
+ } else {
215
+ processedParameterValues[parameter.id] = parameter.value;
216
+ }
217
+ } else {
218
+ parameter.Error = stringResources.stringResources.invalidParameter;
219
+ }
220
+ if (parameter.isVisible || options.showHiddenParameters) {
221
+ $parameterContainer = createParameterUI(parameter);
222
+ if ($parameterContainer) {
223
+ $tempContainer.append($parameterContainer);
224
+ }
225
+ }
226
+ });
227
+ if (initialParameterValues !== void 0) {
228
+ if (null === initialParameterValues) {
229
+ initialParameterValues = {};
230
+ Array.from(parameters$1).forEach((parameter) => {
231
+ if (parameter.isVisible) {
232
+ initialParameterValues[parameter.id] = parameter.value;
233
+ } else {
234
+ delete recentParameterValues[parameter.id];
235
+ }
236
+ });
237
+ } else {
238
+ Array.from(parameters$1).forEach((parameter) => {
239
+ if (!(parameter.id in initialParameterValues)) {
240
+ delete recentParameterValues[parameter.id];
241
+ }
242
+ });
243
+ }
244
+ }
245
+ $content.empty();
246
+ if (parameters$1.length > 0) {
247
+ $content.append($tempContainer.children());
248
+ if (enableAccessibility) {
249
+ $content.attr("aria-label", "Parameters area. Contains " + parameters$1.length + " parameters.");
250
+ }
251
+ }
252
+ showPreviewButton();
253
+ var allValid = allParametersValid();
254
+ enablePreviewButton(allValid);
255
+ applyProcessedParameters();
256
+ }
257
+ function applyParameters() {
258
+ controller.setParameters($.extend({}, recentParameterValues));
259
+ controller.previewReport(false);
260
+ }
261
+ function applyProcessedParameters() {
262
+ controller.setProcessedParameter($.extend({}, processedParameterValues));
263
+ }
264
+ function allParametersValidForAutoRefresh() {
265
+ var triggerAutoUpdate = true;
266
+ for (var i = parameters$1.length - 1; triggerAutoUpdate && i >= 0; i--) {
267
+ var p = parameters$1[i];
268
+ triggerAutoUpdate = p.id in recentParameterValues && (Boolean(p.autoRefresh) || !p.isVisible);
269
+ }
270
+ return triggerAutoUpdate;
271
+ }
272
+ function raiseParametersReady() {
273
+ parametersArea.parametersReady(recentParameterValues);
274
+ }
275
+ function tryRefreshReport() {
276
+ raiseParametersReady();
277
+ if (allParametersValidForAutoRefresh()) {
278
+ applyParameters();
279
+ }
280
+ }
281
+ function invalidateChildParameters(parameter) {
282
+ if (parameter.childParameters) {
283
+ Array.from(parameter.childParameters).forEach((parameterId) => {
284
+ var childParameter = getParameterById(parameterId);
285
+ if (childParameter) {
286
+ invalidateChildParameters(childParameter);
287
+ }
288
+ delete recentParameterValues[parameterId];
289
+ resetPendingParameterChange(parameterId);
290
+ });
291
+ }
292
+ }
293
+ function resetPendingParameterChange(parameterId) {
294
+ if (editors) {
295
+ var editor = editors[parameterId];
296
+ if (editor && typeof editor.clearPendingChange === "function") {
297
+ editor.clearPendingChange();
298
+ }
299
+ }
300
+ }
301
+ function onParameterChanged(parameter, newValue) {
302
+ delete parameter["Error"];
303
+ parameter.value = newValue;
304
+ recentParameterValues[parameter.id] = newValue;
305
+ if (initialParameterValues !== void 0) {
306
+ if (parameter.id in initialParameterValues) {
307
+ recentParameterValues[parameter.id] = newValue;
308
+ }
309
+ } else {
310
+ recentParameterValues[parameter.id] = newValue;
311
+ }
312
+ invalidateChildParameters(parameter);
313
+ if (parameter.childParameters) {
314
+ updateParameters(tryRefreshReport);
315
+ } else {
316
+ var allValid = allParametersValid();
317
+ enablePreviewButton(allValid);
318
+ if (allValid) {
319
+ var errorMsg = document.querySelector(".trv-pages-area .trv-error-message");
320
+ if ($previewButton.is(":visible") && errorMsg) {
321
+ errorMsg.textContent = stringResources.stringResources.tryReportPreview;
322
+ }
323
+ tryRefreshReport();
324
+ }
325
+ }
326
+ }
327
+ function getParameterById(parameterId) {
328
+ if (parameters$1) {
329
+ for (var i = 0; i < parameters$1.length; i++) {
330
+ var p = parameters$1[i];
331
+ if (p.id === parameterId) {
332
+ return p;
333
+ }
334
+ }
335
+ }
336
+ return null;
337
+ }
338
+ function hasVisibleParameters(params) {
339
+ if (!params || null === params) {
340
+ return false;
341
+ }
342
+ var hasVisible = Array.from(params).some((parameter) => {
343
+ return parameter.isVisible;
344
+ });
345
+ return hasVisible;
346
+ }
347
+ var loadingCount = 0;
348
+ function beginLoad() {
349
+ loadingCount++;
350
+ $placeholder.addClass("trv-loading");
351
+ }
352
+ function endLoad() {
353
+ if (loadingCount > 0) {
354
+ if (0 === --loadingCount) {
355
+ $placeholder.removeClass("trv-loading");
356
+ }
357
+ }
358
+ }
359
+ var parametersAreaNecessary = false;
360
+ function onLoadParametersComplete(params, successAction) {
361
+ parametersAreaNecessary = hasVisibleParameters(params);
362
+ if (!parametersAreaNecessary) {
363
+ showParametersArea(false);
364
+ }
365
+ fill(params);
366
+ showError("");
367
+ if (parametersAreaNecessary && parametersAreaVisible) {
368
+ showParametersArea(true);
369
+ if (enableAccessibility) {
370
+ setSplitbarAccessibilityAttributes();
371
+ }
372
+ }
373
+ controller.updateUIInternal();
374
+ if (typeof successAction === "function") {
375
+ successAction();
376
+ }
377
+ endLoad();
378
+ }
379
+ function updateParameters(successAction) {
380
+ acceptParameters(controller.loadParameters(recentParameterValues), successAction);
381
+ }
382
+ function acceptParameters(controllerLoadParametersPromise, successAction) {
383
+ beginLoad();
384
+ controllerLoadParametersPromise.then(function(parameters2) {
385
+ onLoadParametersComplete(parameters2, successAction);
386
+ }).catch(function(error) {
387
+ endLoad();
388
+ clear();
389
+ if (!$placeholder.hasClass("trv-hidden")) {
390
+ showError(error);
391
+ }
392
+ parametersArea.error(error);
393
+ });
394
+ }
395
+ function getEventHandlerFromArguments(args) {
396
+ var arg0;
397
+ if (args && args.length) {
398
+ arg0 = args[0];
399
+ }
400
+ if (typeof arg0 === "function") {
401
+ return arg0;
402
+ }
403
+ return null;
404
+ }
405
+ function eventFactory(event, args) {
406
+ var h = getEventHandlerFromArguments(args);
407
+ if (h) {
408
+ $parametersArea.on(event, h);
409
+ } else {
410
+ $parametersArea.trigger(event, args);
411
+ }
412
+ return controller;
413
+ }
414
+ function onLoadParametersSuccess() {
415
+ if (initialParameterValues === null) {
416
+ initialParameterValues = $.extend({}, recentParameterValues);
417
+ }
418
+ raiseParametersReady();
419
+ }
420
+ function showParametersArea(show) {
421
+ var splitter = globalSettings.GlobalSettings.viewerInstances.find((element) => element.id === options.viewerSelector + "-parameters-splitter").instance;
422
+ var sibling = $placeholder.prev();
423
+ if (options.parametersAreaPosition === enums.ParametersAreaPositions.TOP || options.parametersAreaPosition === enums.ParametersAreaPositions.LEFT) {
424
+ sibling = $placeholder.next();
425
+ }
426
+ if (splitter) {
427
+ (parametersAreaNecessary ? $.fn.removeClass : $.fn.addClass).call(sibling, "trv-hidden");
428
+ splitter.toggle(".trv-parameters-area", show);
429
+ }
430
+ }
431
+ function setSplitbarAccessibilityAttributes() {
432
+ var splitbar = $placeholder.prev();
433
+ var tabIndex = $placeholder.find(".trv-parameters-area-content").attr("tabIndex");
434
+ if (options.parametersAreaPosition === enums.ParametersAreaPositions.TOP || options.parametersAreaPosition === enums.ParametersAreaPositions.LEFT) {
435
+ splitbar = $placeholder.next();
436
+ }
437
+ splitbar.attr("aria-label", stringResources.stringResources.ariaLabelParametersAreaSplitter);
438
+ splitbar.attr("tabIndex", tabIndex);
439
+ }
440
+ function onReloadParameters(event, controllerLoadParametersPromise) {
441
+ showError();
442
+ $content.empty();
443
+ acceptParameters(controllerLoadParametersPromise, onLoadParametersSuccess);
444
+ }
445
+ controller.reloadParameters(onReloadParameters).beforeLoadReport(function() {
446
+ loadingCount = 0;
447
+ beginLoad();
448
+ }).error(endLoad).pageReady(endLoad);
449
+ controller.getParametersAreaState(function(event, args) {
450
+ var parametersAreaNecessary2 = false;
451
+ if (parameters$1) {
452
+ parametersAreaNecessary2 = hasVisibleParameters(parameters$1);
453
+ }
454
+ args.enabled = parametersAreaNecessary2;
455
+ args.visible = parametersAreaVisible;
456
+ }).setParametersAreaVisible(function(event, args) {
457
+ parametersAreaVisible = args.visible;
458
+ showParametersArea(args.visible && hasVisibleParameters(parameters$1));
459
+ });
460
+ function clear() {
461
+ fill([]);
462
+ }
463
+ $.extend(
464
+ parametersArea,
465
+ {
466
+ allParametersValid: function() {
467
+ return allParametersValid();
468
+ },
469
+ clear: function() {
470
+ clear();
471
+ },
472
+ error: function() {
473
+ return eventFactory(Events.ERROR, arguments);
474
+ },
475
+ parametersReady: function() {
476
+ return eventFactory(Events.PARAMETERS_READY, arguments);
477
+ },
478
+ setParameters: function(parameterValues) {
479
+ initialParameterValues = null === parameterValues ? null : $.extend({}, parameterValues);
480
+ }
481
+ }
482
+ );
483
+ return parametersArea;
484
+ }
485
+
486
+ 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;