@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
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  This package is part of [Telerik Reporting](https://www.telerik.com/reporting).
4
4
 
5
- This version of Telerik jQuery Report Viewer requires Telerik Report Server or Telerik Reporting REST Service 18.0.24.305.
5
+ This version of Telerik jQuery Report Viewer requires Telerik Report Server or Telerik Reporting REST Service 18.1.24.514.
6
6
 
7
7
  __Intended for internal purposes only.__
8
8
 
@@ -0,0 +1,218 @@
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
+
8
+ var defaultOptions = {};
9
+ function Accessibility(options) {
10
+ var controller;
11
+ var pageInitialized = false;
12
+ var areas;
13
+ var lastArea;
14
+ var keyMap = {
15
+ //keys for navigating on areas. Used in conjunction with CTRL+ALT to avoid duplicating default shortcuts behavior.
16
+ CONFIRM_KEY: 13,
17
+ CONTENT_AREA_KEY: 67,
18
+ //C
19
+ DOCUMENT_MAP_AREA_KEY: 68,
20
+ //D
21
+ MENU_AREA_KEY: 77,
22
+ //M
23
+ PARAMETERS_AREA_KEY: 80
24
+ //P
25
+ };
26
+ options = $.extend({}, defaultOptions, options);
27
+ controller = options.controller;
28
+ if (!controller) {
29
+ throw "No controller (telerikReporting.ReportViewerController) has been specified.";
30
+ }
31
+ controller.reportLoadComplete(function() {
32
+ setAccessibilityUI();
33
+ var content = findContentArea();
34
+ if (content.length > 0) {
35
+ content.focus();
36
+ }
37
+ }).pageReady(function(event, page) {
38
+ initPage(page);
39
+ pageInitialized = true;
40
+ }).error(function(e, message) {
41
+ focusOnErrorMessage();
42
+ window.setTimeout(setAccessibilityUI, 500);
43
+ });
44
+ controller.updateUI(function(e) {
45
+ if (pageInitialized) {
46
+ setPageSelector();
47
+ decorateMenuItems();
48
+ }
49
+ });
50
+ function setAccessibilityUI() {
51
+ if (!areas) {
52
+ initAreas();
53
+ $(document.body).off("keydown", processKeyDown);
54
+ $(document.body).on("keydown", processKeyDown);
55
+ }
56
+ }
57
+ function focusOnErrorMessage() {
58
+ var selectorChain = ["div.trv-pages-area", "div.trv-error-message"];
59
+ var $errMsg = utils.findElement(selectorChain);
60
+ if ($errMsg.length === 0) {
61
+ return;
62
+ }
63
+ $errMsg.attr("tabIndex", 0);
64
+ $errMsg.focus();
65
+ }
66
+ function initPage(page) {
67
+ if (!page) {
68
+ return;
69
+ }
70
+ setAccessibilityUI();
71
+ var area = areas[keyMap.CONTENT_AREA_KEY];
72
+ setContentAreaKeyDown(area);
73
+ }
74
+ function setPageSelector() {
75
+ var $pagers = $(".trv-report-pager");
76
+ if ($pagers.length > 0) {
77
+ var pageNumber = controller.getCurrentPageNumber();
78
+ var pageCount = controller.getPageCount();
79
+ utils.each($pagers, function() {
80
+ var $pager = $(this);
81
+ $pager.attr("aria-label", utils.stringFormat(stringResources.stringResources.ariaLabelPageNumberSelector, [pageNumber, pageCount]));
82
+ var $pageInputs = $pager.find("input[data-role=telerik_ReportViewer_PageNumberInput]");
83
+ if ($pageInputs.length > 0) {
84
+ utils.each($pageInputs, function() {
85
+ var $this = $(this);
86
+ $this.attr("aria-label", stringResources.stringResources.ariaLabelPageNumberEditor);
87
+ $this.attr("min", "1");
88
+ $this.attr("max", "" + pageCount);
89
+ });
90
+ }
91
+ });
92
+ }
93
+ }
94
+ function initAreas() {
95
+ areas = {};
96
+ areas[keyMap.DOCUMENT_MAP_AREA_KEY] = findDocumentMapArea();
97
+ areas[keyMap.MENU_AREA_KEY] = findMenuArea();
98
+ areas[keyMap.CONTENT_AREA_KEY] = findContentArea();
99
+ var parametersArea = findParametersArea();
100
+ if (parametersArea) {
101
+ areas[keyMap.PARAMETERS_AREA_KEY] = parametersArea;
102
+ setParameterEditorsKeyDown(parametersArea);
103
+ }
104
+ }
105
+ function findContentArea() {
106
+ return utils.findElement(["div[data-role=telerik_ReportViewer_PagesArea]"]);
107
+ }
108
+ function findDocumentMapArea() {
109
+ return utils.findElement(["div[data-role=telerik_ReportViewer_DocumentMapArea]", "div[data-role=treeview]"]);
110
+ }
111
+ function findMenuArea() {
112
+ return utils.findElement("ul[data-role=telerik_ReportViewer_MainMenu]");
113
+ }
114
+ function findParametersArea() {
115
+ return utils.findElement(["div[data-role=telerik_ReportViewer_ParametersArea]", "div.trv-parameters-area-content"]);
116
+ }
117
+ function processKeyDown(event) {
118
+ if (!areas) {
119
+ return;
120
+ }
121
+ if (!(event.altKey && event.ctrlKey)) {
122
+ return;
123
+ }
124
+ var currentArea = areas[event.which];
125
+ if (!currentArea) {
126
+ return;
127
+ }
128
+ if (!IsAreaContainerVisible(currentArea.parent())) {
129
+ return;
130
+ }
131
+ var className = "k-focus";
132
+ if (lastArea) {
133
+ lastArea.removeClass(className);
134
+ }
135
+ currentArea.addClass(className);
136
+ currentArea.focus();
137
+ lastArea = currentArea;
138
+ event.preventDefault();
139
+ }
140
+ function setParameterEditorsKeyDown(parametersAreaContent) {
141
+ if (parametersAreaContent.length === 0) {
142
+ return;
143
+ }
144
+ var $paramsArea = parametersAreaContent.parent("div[data-role=telerik_ReportViewer_ParametersArea]");
145
+ if (!IsAreaContainerVisible($paramsArea)) {
146
+ return;
147
+ }
148
+ utils.each(parametersAreaContent.children(), function() {
149
+ $(this).keydown(function(event) {
150
+ if (event.which == keyMap.CONFIRM_KEY) {
151
+ var paramsButton = $paramsArea.find("button.trv-parameters-area-preview-button");
152
+ paramsButton.focus();
153
+ event.preventDefault();
154
+ }
155
+ });
156
+ });
157
+ }
158
+ function IsAreaContainerVisible(container) {
159
+ return container && !(container.hasClass("k-collapsed") || container.hasClass("trv-hidden"));
160
+ }
161
+ function setContentAreaKeyDown(contentArea) {
162
+ if (!contentArea) {
163
+ return;
164
+ }
165
+ var actions = contentArea.find("div [data-reporting-action]");
166
+ if (!actions.length > 0) {
167
+ return;
168
+ }
169
+ utils.each(actions, function() {
170
+ var $action = $(this);
171
+ $action.keydown(function(event) {
172
+ if (event.which == keyMap.CONFIRM_KEY) {
173
+ $action.click();
174
+ }
175
+ });
176
+ });
177
+ }
178
+ function decorateMenuItems() {
179
+ var menuAreas = areas[keyMap.MENU_AREA_KEY];
180
+ if (!menuAreas) {
181
+ return;
182
+ }
183
+ utils.each(menuAreas, function() {
184
+ var $menu = $(this);
185
+ var menuItems = $menu.children("li.k-item");
186
+ utils.each(menuItems, function() {
187
+ var $menuItem = $(this);
188
+ if (!$menuItem.hasClass("trv-report-pager")) {
189
+ var ariaLabel = $menuItem.attr("aria-label");
190
+ var expandableSr = utils.stringFormat(". {0}", [stringResources.stringResources.ariaLabelExpandable]);
191
+ var expandable = $menuItem.find("ul").length > 0 && ariaLabel.indexOf(expandableSr) < 0 ? expandableSr : "";
192
+ var selectedSr = utils.stringFormat(". {0}", [stringResources.stringResources.ariaLabelSelected]);
193
+ var selected = $menuItem.hasClass("k-selected") && ariaLabel.indexOf(selectedSr) < 0 ? selectedSr : "";
194
+ var label = ariaLabel + expandable + selected;
195
+ $menuItem.attr("aria-label", label);
196
+ if ($menuItem.hasClass("k-disabled")) {
197
+ $menuItem.attr("aria-disabled", "true");
198
+ } else {
199
+ $menuItem.removeAttr("aria-disabled");
200
+ }
201
+ }
202
+ });
203
+ });
204
+ }
205
+ function setKeyMap(keyMapValues) {
206
+ keyMap = keyMapValues;
207
+ areas = void 0;
208
+ }
209
+ function getKeyMap() {
210
+ return keyMap;
211
+ }
212
+ return {
213
+ getKeyMap,
214
+ setKeyMap
215
+ };
216
+ }
217
+
218
+ exports.Accessibility = Accessibility;
@@ -0,0 +1,172 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var utils = require('./utils.js');
6
+ var globalSettings = require('./globalSettings.js');
7
+
8
+ var Binder = {
9
+ bind: function($element) {
10
+ var args = Array.prototype.slice.call(arguments, 1);
11
+ attachCommands($element, args);
12
+ var result = $element.find('[data-role^="telerik_ReportViewer_"]');
13
+ utils.each(result, function() {
14
+ var $this = $(this);
15
+ var f = $.fn[$this.attr("data-role")];
16
+ if (typeof f === "function") {
17
+ f.apply($this, args);
18
+ }
19
+ });
20
+ }
21
+ };
22
+ function attachCommands($element, args) {
23
+ var commands = args[0].commands;
24
+ var viewerOptions = args[1];
25
+ var elementSelector = '[data-command^="telerik_ReportViewer_"]';
26
+ var customElementSelector = "[data-target-report-viewer]" + elementSelector;
27
+ $element.on("click", elementSelector, commandHandler);
28
+ if (!globalSettings.GlobalSettings.CommandHandlerAttached) {
29
+ $(document.body).on("click", customElementSelector, customCommandHandler);
30
+ globalSettings.GlobalSettings.CommandHandlerAttached = true;
31
+ }
32
+ utils.each(commands, function(key, command) {
33
+ attachCommand(key, command, viewerOptions, $element);
34
+ });
35
+ function commandHandler(e) {
36
+ var prefixedDataCommand = $(this).attr("data-command");
37
+ if (prefixedDataCommand) {
38
+ var dataCommand = prefixedDataCommand.substring("telerik_ReportViewer_".length);
39
+ var cmd = commands[dataCommand];
40
+ if (cmd && cmd.enabled()) {
41
+ cmd.exec($(this).attr("data-command-parameter"));
42
+ }
43
+ e.preventDefault();
44
+ }
45
+ }
46
+ function customCommandHandler(e) {
47
+ var $this = $(this);
48
+ var prefixedDataCommand = $this.attr("data-command");
49
+ var reportViewerTarget = $this.attr("data-target-report-viewer");
50
+ if (prefixedDataCommand && reportViewerTarget) {
51
+ var dataCommand = prefixedDataCommand.substring("telerik_ReportViewer_".length);
52
+ var reportViewer = $(reportViewerTarget).data("telerik_ReportViewer");
53
+ var cmd = reportViewer.commands[dataCommand];
54
+ if (cmd.enabled()) {
55
+ cmd.exec($(this).attr("data-command-parameter"));
56
+ }
57
+ e.preventDefault();
58
+ }
59
+ }
60
+ }
61
+ function attachCommand(dataCommand, cmd, viewerOptions, $element) {
62
+ if (cmd) {
63
+ var elementSelector = '[data-command="telerik_ReportViewer_' + dataCommand + '"]';
64
+ var customElementSelector = '[data-target-report-viewer="' + viewerOptions.selector + '"]' + elementSelector;
65
+ var $defaultElement = $element.find(elementSelector);
66
+ var $customElement = $(customElementSelector);
67
+ $(cmd).on("enabledChanged", function(e) {
68
+ (cmd.enabled() ? $.fn.removeClass : $.fn.addClass).call($defaultElement.parent("li"), "k-disabled");
69
+ (cmd.enabled() ? $.fn.removeClass : $.fn.addClass).call($customElement, viewerOptions.disabledButtonClass);
70
+ }).on("checkedChanged", function(e) {
71
+ var defaultTarget = $defaultElement.parent("li");
72
+ (cmd.checked() ? $.fn.addClass : $.fn.removeClass).call(defaultTarget, getSelectedClassName(defaultTarget));
73
+ (cmd.checked() ? $.fn.addClass : $.fn.removeClass).call($customElement, viewerOptions.checkedButtonClass);
74
+ });
75
+ }
76
+ }
77
+ function getSelectedClassName($element) {
78
+ return $element.hasClass("trv-menu-toggleable") ? "k-selected !k-bg-primary" : "k-selected";
79
+ }
80
+ function LinkButton(dom, options) {
81
+ var cmd;
82
+ var $element = $(dom);
83
+ var dataCommand = $element.attr("data-command");
84
+ if (dataCommand) {
85
+ cmd = options.commands[dataCommand];
86
+ }
87
+ if (cmd) {
88
+ $element.click(function(e) {
89
+ if (cmd.enabled()) {
90
+ cmd.exec($(this).attr("data-command-parameter"));
91
+ } else {
92
+ e.preventDefault();
93
+ }
94
+ });
95
+ $(cmd).on("enabledChanged", function(e) {
96
+ (cmd.enabled() ? $.fn.removeClass : $.fn.addClass).call($element, "disabled");
97
+ }).on("checkedChanged", function(e) {
98
+ (cmd.checked() ? $.fn.addClass : $.fn.removeClass).call($element, "checked");
99
+ });
100
+ }
101
+ }
102
+ var linkButton_pluginName = "telerik_ReportViewer_LinkButton";
103
+ $.fn[linkButton_pluginName] = function(options) {
104
+ return utils.each(this, function() {
105
+ if (!$.data(this, linkButton_pluginName)) {
106
+ $.data(this, linkButton_pluginName, new LinkButton(this, options));
107
+ }
108
+ });
109
+ };
110
+ function PageNumberInput(dom, options) {
111
+ var $element = $(dom);
112
+ var oldValue = 0;
113
+ var cmd = options.commands["goToPage"];
114
+ function setPageNumber(value) {
115
+ if (oldValue !== value || !$element.is(":focus")) {
116
+ $element.val(value);
117
+ oldValue = value;
118
+ }
119
+ }
120
+ options.controller.pageNumberChange(function(e, value) {
121
+ setPageNumber(value);
122
+ });
123
+ $element.change(function() {
124
+ var val = $(this).val();
125
+ var num = utils.tryParseInt(val);
126
+ if (!isNaN(num)) {
127
+ var result = cmd.exec(num);
128
+ setPageNumber(result);
129
+ }
130
+ });
131
+ $element.keydown(function(e) {
132
+ if (e.which == 13) {
133
+ $(this).change();
134
+ return e.preventDefault();
135
+ }
136
+ });
137
+ function validateValue(value) {
138
+ return /^([0-9]+)$/.test(value);
139
+ }
140
+ $element.keypress(function(event) {
141
+ if (utils.isSpecialKey(event.keyCode)) {
142
+ return true;
143
+ }
144
+ var newValue = $element.val() + String.fromCharCode(event.charCode);
145
+ return validateValue(newValue);
146
+ }).on("paste", function(event) {
147
+ });
148
+ }
149
+ var pageNumberInput_pluginName = "telerik_ReportViewer_PageNumberInput";
150
+ $.fn[pageNumberInput_pluginName] = function(options) {
151
+ return utils.each(this, function() {
152
+ if (!$.data(this, pageNumberInput_pluginName)) {
153
+ $.data(this, pageNumberInput_pluginName, new PageNumberInput(this, options));
154
+ }
155
+ });
156
+ };
157
+ function PageCountLabel(dom, options) {
158
+ var $element = $(dom);
159
+ options.controller.pageCountChange(function(e, value) {
160
+ $element.text(value);
161
+ });
162
+ }
163
+ var pageCountLabel_pluginName = "telerik_ReportViewer_PageCountLabel";
164
+ $.fn[pageCountLabel_pluginName] = function(options) {
165
+ return utils.each(this, function() {
166
+ if (!$.data(this, pageCountLabel_pluginName)) {
167
+ $.data(this, pageCountLabel_pluginName, new PageCountLabel(this, options));
168
+ }
169
+ });
170
+ };
171
+
172
+ exports.Binder = Binder;
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function Command(execCallback) {
6
+ var enabledState = true;
7
+ var checkedState = false;
8
+ var cmd = {
9
+ enabled: function(state) {
10
+ if (arguments.length === 0) {
11
+ return enabledState;
12
+ }
13
+ var newState = Boolean(state);
14
+ enabledState = newState;
15
+ $(this).trigger("enabledChanged");
16
+ return cmd;
17
+ },
18
+ checked: function(state) {
19
+ if (arguments.length === 0) {
20
+ return checkedState;
21
+ }
22
+ var newState = Boolean(state);
23
+ checkedState = newState;
24
+ $(this).trigger("checkedChanged");
25
+ return cmd;
26
+ },
27
+ exec: execCallback
28
+ };
29
+ return cmd;
30
+ }
31
+
32
+ exports.Command = Command;
@@ -0,0 +1,167 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var enums = require('./enums.js');
6
+ var command = require('./command.js');
7
+
8
+ var scaleTransitionMap = {};
9
+ scaleTransitionMap[enums.ScaleModes.FIT_PAGE] = { scaleMode: enums.ScaleModes.FIT_PAGE_WIDTH };
10
+ scaleTransitionMap[enums.ScaleModes.FIT_PAGE_WIDTH] = { scaleMode: enums.ScaleModes.SPECIFIC, scale: 1 };
11
+ scaleTransitionMap[enums.ScaleModes.SPECIFIC] = { scaleMode: enums.ScaleModes.FIT_PAGE };
12
+ var scaleValues = [0.1, 0.25, 0.5, 0.75, 1, 1.5, 2, 4, 8];
13
+ function CommandSet(options) {
14
+ var controller = options.controller;
15
+ if (!controller) {
16
+ throw "No options.controller.";
17
+ }
18
+ var historyManager = options.history;
19
+ if (!historyManager) {
20
+ throw "No options.history.";
21
+ }
22
+ function getDocumentMapVisible() {
23
+ var args = {};
24
+ controller.getDocumentMapState(args);
25
+ return Boolean(args.visible);
26
+ }
27
+ function getParametersAreaVisible() {
28
+ var args = {};
29
+ controller.getParametersAreaState(args);
30
+ return Boolean(args.visible);
31
+ }
32
+ function getSideMenuVisible() {
33
+ var args = {};
34
+ controller.getSideMenuVisible(args);
35
+ return Boolean(args.visible);
36
+ }
37
+ function getSearchDialogVisible() {
38
+ var args = {};
39
+ controller.getSearchDialogState(args);
40
+ return Boolean(args.visible);
41
+ }
42
+ function getSendEmailDialogVisible() {
43
+ var args = {};
44
+ controller.getSendEmailDialogState(args);
45
+ return Boolean(args.visible);
46
+ }
47
+ return {
48
+ "historyBack": new command.Command(function() {
49
+ historyManager.back();
50
+ }),
51
+ "historyForward": new command.Command(function() {
52
+ historyManager.forward();
53
+ }),
54
+ "stopRendering": new command.Command(function() {
55
+ controller.stopRendering();
56
+ }),
57
+ "goToPrevPage": new command.Command(function() {
58
+ controller.navigateToPage(controller.getCurrentPageNumber() - 1);
59
+ }),
60
+ "goToNextPage": new command.Command(function() {
61
+ controller.navigateToPage(controller.getCurrentPageNumber() + 1);
62
+ }),
63
+ "goToFirstPage": new command.Command(function() {
64
+ controller.navigateToPage(1);
65
+ }),
66
+ "goToLastPage": new command.Command(function() {
67
+ controller.navigateToPage(controller.getPageCount());
68
+ }),
69
+ "goToPage": new command.Command(function(pageNumber) {
70
+ if (!isNaN(pageNumber)) {
71
+ var pageCount = controller.getPageCount();
72
+ if (pageNumber > pageCount) {
73
+ pageNumber = pageCount;
74
+ } else if (pageNumber < 1) {
75
+ pageNumber = 1;
76
+ }
77
+ controller.navigateToPage(pageNumber);
78
+ return pageNumber;
79
+ }
80
+ }),
81
+ "refresh": new command.Command(
82
+ function() {
83
+ controller.refreshReport(true);
84
+ }
85
+ ),
86
+ "export": new command.Command(function(format) {
87
+ if (format) {
88
+ controller.exportReport(format);
89
+ }
90
+ }),
91
+ "print": new command.Command(function() {
92
+ controller.printReport();
93
+ }),
94
+ "pageMode": new command.Command(function() {
95
+ controller.setPageMode(
96
+ controller.getPageMode() === enums.PageModes.SINGLE_PAGE ? enums.PageModes.CONTINUOUS_SCROLL : enums.PageModes.SINGLE_PAGE
97
+ );
98
+ }),
99
+ "togglePrintPreview": new command.Command(function() {
100
+ controller.setViewMode(
101
+ controller.getViewMode() === enums.ViewModes.PRINT_PREVIEW ? enums.ViewModes.INTERACTIVE : enums.ViewModes.PRINT_PREVIEW
102
+ );
103
+ }),
104
+ "toggleDocumentMap": new command.Command(function() {
105
+ controller.setDocumentMapVisible({ visible: !getDocumentMapVisible() });
106
+ }),
107
+ "toggleParametersArea": new command.Command(function() {
108
+ controller.setParametersAreaVisible({ visible: !getParametersAreaVisible() });
109
+ }),
110
+ "zoom": new command.Command(function(scale) {
111
+ controller.setScale(scale);
112
+ }),
113
+ "zoomIn": new command.Command(function() {
114
+ zoom(1);
115
+ }),
116
+ "zoomOut": new command.Command(function() {
117
+ zoom(-1);
118
+ }),
119
+ "toggleSideMenu": new command.Command(function() {
120
+ controller.setSideMenuVisible({ visible: !getSideMenuVisible() });
121
+ }),
122
+ "toggleZoomMode": new command.Command(function(e) {
123
+ var scale = controller.getScale();
124
+ var scaleMode = controller.getScaleMode();
125
+ controller.setScale(scaleTransitionMap[scaleMode].scale || scale);
126
+ controller.setScaleMode(scaleTransitionMap[scaleMode].scaleMode);
127
+ }),
128
+ "toggleSearchDialog": new command.Command(function() {
129
+ controller.setSearchDialogVisible({ visible: !getSearchDialogVisible() });
130
+ }),
131
+ "toggleSendEmailDialog": new command.Command(function() {
132
+ controller.setSendEmailDialogVisible({ visible: !getSendEmailDialogVisible() });
133
+ })
134
+ };
135
+ function zoom(step) {
136
+ controller.setScale(getZoomScale(controller.getScale(), step));
137
+ }
138
+ function getZoomScale(scale, steps) {
139
+ var pos = -1;
140
+ var length = scaleValues.length;
141
+ for (var i = 0; i < length; i++) {
142
+ var value = scaleValues[i];
143
+ if (scale < value) {
144
+ pos = i - 0.5;
145
+ break;
146
+ }
147
+ if (scale === value) {
148
+ pos = i;
149
+ break;
150
+ }
151
+ }
152
+ pos = pos + steps;
153
+ if (steps >= 0) {
154
+ pos = Math.round(pos - 0.49);
155
+ } else {
156
+ pos = Math.round(pos + 0.49);
157
+ }
158
+ if (pos < 0) {
159
+ pos = 0;
160
+ } else if (pos > length - 1) {
161
+ pos = length - 1;
162
+ }
163
+ return scaleValues[pos];
164
+ }
165
+ }
166
+
167
+ exports.CommandSet = CommandSet;