@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.
- package/README.md +1 -1
- package/dist/cjs/accessibility.js +208 -0
- package/dist/cjs/base-component.js +26 -0
- package/dist/cjs/binder.js +79 -0
- package/dist/cjs/command.js +32 -0
- package/dist/cjs/commandSet.js +167 -0
- package/dist/cjs/controller.js +1204 -0
- package/dist/cjs/documentMapArea.js +159 -0
- package/dist/cjs/domUtils.js +50 -0
- package/dist/cjs/enums.js +52 -0
- package/dist/cjs/event-emitter.js +131 -0
- package/dist/cjs/events.js +23 -0
- package/dist/cjs/globalSettings.js +9 -0
- package/dist/cjs/history.js +131 -0
- package/dist/cjs/index.js +58 -0
- package/dist/cjs/jqueryThrottleDebounce.js +48 -0
- package/dist/cjs/kendo-jquery.js +4 -0
- package/dist/cjs/mainMenu.js +323 -0
- package/dist/cjs/mem-storage.js +44 -0
- package/dist/cjs/pagesArea.js +622 -0
- package/dist/cjs/parameterValidators.js +164 -0
- package/dist/cjs/parameters.js +921 -0
- package/dist/cjs/parametersArea.js +486 -0
- package/dist/cjs/perspectives.js +138 -0
- package/dist/cjs/print.js +165 -0
- package/dist/cjs/report-viewer/report-viewer-settings.js +138 -0
- package/dist/cjs/reportViewer.js +665 -0
- package/dist/cjs/scroll.js +535 -0
- package/dist/cjs/search.js +584 -0
- package/dist/cjs/sendEmail.js +392 -0
- package/dist/cjs/service-client-sentinel.js +52 -0
- package/dist/cjs/serviceClient.js +311 -0
- package/dist/cjs/sideMenu.js +216 -0
- package/dist/cjs/sr.js +164 -0
- package/dist/cjs/stringResources.js +11 -0
- package/dist/cjs/telerikReportViewer.kendo.js +60196 -0
- package/dist/cjs/telerikReportViewer.kendo.min.js +19776 -0
- package/dist/cjs/template-cache.js +39 -0
- package/dist/cjs/toolbar/link-button.js +42 -0
- package/dist/cjs/toolbar/page-count-label.js +18 -0
- package/dist/cjs/toolbar/page-number-input.js +64 -0
- package/dist/cjs/touch.js +86 -0
- package/dist/cjs/uiController.js +142 -0
- package/dist/cjs/uiFreezeCoordinator.js +282 -0
- package/dist/cjs/utils.js +489 -0
- package/dist/es/accessibility.js +204 -0
- package/dist/es/base-component.js +22 -0
- package/dist/es/binder.js +75 -0
- package/dist/es/command.js +28 -0
- package/dist/es/commandSet.js +163 -0
- package/dist/es/controller.js +1200 -0
- package/dist/es/documentMapArea.js +155 -0
- package/dist/es/domUtils.js +43 -0
- package/dist/es/enums.js +41 -0
- package/dist/es/event-emitter.js +127 -0
- package/dist/es/events.js +19 -0
- package/dist/es/globalSettings.js +5 -0
- package/dist/es/history.js +127 -0
- package/dist/es/index.js +24 -0
- package/dist/es/jqueryThrottleDebounce.js +46 -0
- package/dist/es/kendo-jquery.js +1 -0
- package/dist/es/mainMenu.js +319 -0
- package/dist/es/mem-storage.js +40 -0
- package/dist/es/pagesArea.js +618 -0
- package/dist/es/parameterValidators.js +160 -0
- package/dist/es/parameters.js +916 -0
- package/dist/es/parametersArea.js +482 -0
- package/dist/es/perspectives.js +134 -0
- package/dist/es/print.js +161 -0
- package/dist/es/report-viewer/report-viewer-settings.js +134 -0
- package/dist/es/reportViewer.js +661 -0
- package/dist/es/scroll.js +531 -0
- package/dist/es/search.js +580 -0
- package/dist/es/sendEmail.js +388 -0
- package/dist/es/service-client-sentinel.js +48 -0
- package/dist/es/serviceClient.js +307 -0
- package/dist/es/sideMenu.js +212 -0
- package/dist/es/sr.js +162 -0
- package/dist/es/stringResources.js +7 -0
- package/dist/es/telerikReportViewer.kendo.js +60194 -0
- package/dist/es/telerikReportViewer.kendo.min.js +19774 -0
- package/dist/es/template-cache.js +35 -0
- package/dist/es/toolbar/link-button.js +38 -0
- package/dist/es/toolbar/page-count-label.js +14 -0
- package/dist/es/toolbar/page-number-input.js +60 -0
- package/dist/es/touch.js +82 -0
- package/dist/es/uiController.js +138 -0
- package/dist/es/uiFreezeCoordinator.js +278 -0
- package/dist/es/utils.js +444 -0
- package/dist/font/font-icons.css +4 -4
- package/dist/font/font-icons.min.css +3 -3
- package/dist/js/telerikReportViewer.js +8346 -8507
- package/dist/js/telerikReportViewer.min.js +1 -17
- package/dist/js/telerikReportViewer.stringResources.js +166 -173
- package/dist/styles/telerikReportViewer.css +3 -3
- package/dist/styles/telerikReportViewer.min.css +3 -3
- package/dist/templates/telerikReportViewerTemplate-FA.html +4 -4
- package/dist/templates/telerikReportViewerTemplate.html +6 -6
- package/package.json +14 -7
- /package/dist/font/{ReportingIcons-18.0.24.305.ttf → ReportingIcons-18.1.24.709.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.
|
5
|
+
This version of Telerik jQuery Report Viewer requires Telerik Report Server or Telerik Reporting REST Service 18.1.24.709.
|
6
6
|
|
7
7
|
__Intended for internal purposes only.__
|
8
8
|
|
@@ -0,0 +1,208 @@
|
|
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
|
+
CONFIRM_KEY: 13,
|
16
|
+
// C
|
17
|
+
CONTENT_AREA_KEY: 67,
|
18
|
+
// D
|
19
|
+
DOCUMENT_MAP_AREA_KEY: 68,
|
20
|
+
// M
|
21
|
+
MENU_AREA_KEY: 77,
|
22
|
+
// P
|
23
|
+
PARAMETERS_AREA_KEY: 80
|
24
|
+
};
|
25
|
+
options = $.extend({}, defaultOptions, options);
|
26
|
+
controller = options.controller;
|
27
|
+
if (!controller) {
|
28
|
+
throw "No controller (telerikReporting.ReportViewerController) has been specified.";
|
29
|
+
}
|
30
|
+
controller.reportLoadComplete(function() {
|
31
|
+
setAccessibilityUI();
|
32
|
+
var content = findContentArea();
|
33
|
+
if (content.length > 0) {
|
34
|
+
content.focus();
|
35
|
+
}
|
36
|
+
}).pageReady(function(event, page) {
|
37
|
+
initPage(page);
|
38
|
+
pageInitialized = true;
|
39
|
+
}).error(function(e, message) {
|
40
|
+
focusOnErrorMessage();
|
41
|
+
window.setTimeout(setAccessibilityUI, 500);
|
42
|
+
});
|
43
|
+
controller.updateUI(function(e) {
|
44
|
+
if (pageInitialized) {
|
45
|
+
setPageSelector();
|
46
|
+
decorateMenuItems();
|
47
|
+
}
|
48
|
+
});
|
49
|
+
function setAccessibilityUI() {
|
50
|
+
if (!areas) {
|
51
|
+
initAreas();
|
52
|
+
$(document.body).off("keydown", processKeyDown);
|
53
|
+
$(document.body).on("keydown", processKeyDown);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
function focusOnErrorMessage() {
|
57
|
+
var $errMsg = $("div.trv-pages-area div.trv-error-message");
|
58
|
+
if ($errMsg.length === 0) {
|
59
|
+
return;
|
60
|
+
}
|
61
|
+
$errMsg.attr("tabIndex", 0);
|
62
|
+
$errMsg.focus();
|
63
|
+
}
|
64
|
+
function initPage(page) {
|
65
|
+
if (!page) {
|
66
|
+
return;
|
67
|
+
}
|
68
|
+
setAccessibilityUI();
|
69
|
+
var area = areas[keyMap.CONTENT_AREA_KEY];
|
70
|
+
setContentAreaKeyDown(area);
|
71
|
+
}
|
72
|
+
function setPageSelector() {
|
73
|
+
var pagers = document.querySelectorAll(".trv-report-pager");
|
74
|
+
var pageNumber = this._controller.getCurrentPageNumber();
|
75
|
+
var pageCount = this._controller.getPageCount();
|
76
|
+
pagers.forEach((pager) => {
|
77
|
+
pager.setAttribute("aria-label", utils.stringFormat(stringResources.stringResources.ariaLabelPageNumberSelector, [pageNumber, pageCount]));
|
78
|
+
var pageInputs = pager.querySelectorAll("input[data-role=telerik_ReportViewer_PageNumberInput]");
|
79
|
+
pageInputs.forEach((input) => {
|
80
|
+
input.setAttribute("aria-label", stringResources.stringResources.ariaLabelPageNumberEditor);
|
81
|
+
});
|
82
|
+
});
|
83
|
+
}
|
84
|
+
function initAreas() {
|
85
|
+
areas = {};
|
86
|
+
areas[keyMap.DOCUMENT_MAP_AREA_KEY] = findDocumentMapArea();
|
87
|
+
areas[keyMap.MENU_AREA_KEY] = findMenuArea();
|
88
|
+
areas[keyMap.CONTENT_AREA_KEY] = findContentArea();
|
89
|
+
var parametersArea = findParametersArea();
|
90
|
+
if (parametersArea) {
|
91
|
+
areas[keyMap.PARAMETERS_AREA_KEY] = parametersArea;
|
92
|
+
setParameterEditorsKeyDown(parametersArea);
|
93
|
+
}
|
94
|
+
}
|
95
|
+
function findContentArea() {
|
96
|
+
return $("div[data-role=telerik_ReportViewer_PagesArea]");
|
97
|
+
}
|
98
|
+
function findDocumentMapArea() {
|
99
|
+
return $("div[data-role=telerik_ReportViewer_DocumentMapArea] div[data-role=treeview]");
|
100
|
+
}
|
101
|
+
function findMenuArea() {
|
102
|
+
return $("ul[data-role=telerik_ReportViewer_MainMenu]");
|
103
|
+
}
|
104
|
+
function findParametersArea() {
|
105
|
+
return $("div[data-role=telerik_ReportViewer_ParametersArea] div.trv-parameters-area-content");
|
106
|
+
}
|
107
|
+
function processKeyDown(event) {
|
108
|
+
if (!areas) {
|
109
|
+
return;
|
110
|
+
}
|
111
|
+
if (!(event.altKey && event.ctrlKey)) {
|
112
|
+
return;
|
113
|
+
}
|
114
|
+
var currentArea = areas[event.which];
|
115
|
+
if (!currentArea) {
|
116
|
+
return;
|
117
|
+
}
|
118
|
+
if (!IsAreaContainerVisible(currentArea.parent())) {
|
119
|
+
return;
|
120
|
+
}
|
121
|
+
var className = "k-focus";
|
122
|
+
if (lastArea) {
|
123
|
+
lastArea.removeClass(className);
|
124
|
+
}
|
125
|
+
currentArea.addClass(className);
|
126
|
+
currentArea.focus();
|
127
|
+
lastArea = currentArea;
|
128
|
+
event.preventDefault();
|
129
|
+
}
|
130
|
+
function setParameterEditorsKeyDown(parametersAreaContent) {
|
131
|
+
if (parametersAreaContent.length === 0) {
|
132
|
+
return;
|
133
|
+
}
|
134
|
+
var $paramsArea = parametersAreaContent.parent("div[data-role=telerik_ReportViewer_ParametersArea]");
|
135
|
+
if (!IsAreaContainerVisible($paramsArea)) {
|
136
|
+
return;
|
137
|
+
}
|
138
|
+
Array.from(parametersAreaContent.children()).forEach((child) => {
|
139
|
+
$(child).on("keydown", (event) => {
|
140
|
+
if (event.which == keyMap.CONFIRM_KEY) {
|
141
|
+
var paramsButton = $paramsArea.find("button.trv-parameters-area-preview-button");
|
142
|
+
paramsButton.focus();
|
143
|
+
event.preventDefault();
|
144
|
+
}
|
145
|
+
});
|
146
|
+
});
|
147
|
+
}
|
148
|
+
function IsAreaContainerVisible(container) {
|
149
|
+
return container && !(container.hasClass("k-collapsed") || container.hasClass("trv-hidden"));
|
150
|
+
}
|
151
|
+
function setContentAreaKeyDown(contentArea) {
|
152
|
+
if (!contentArea) {
|
153
|
+
return;
|
154
|
+
}
|
155
|
+
var actions = contentArea.find("div [data-reporting-action]");
|
156
|
+
if (!actions.length > 0) {
|
157
|
+
return;
|
158
|
+
}
|
159
|
+
Array.from(actions).forEach((action) => {
|
160
|
+
var $action = $(action);
|
161
|
+
$action.on("keydown", (event) => {
|
162
|
+
if (event.which == keyMap.CONFIRM_KEY) {
|
163
|
+
$action.trigger("click");
|
164
|
+
}
|
165
|
+
});
|
166
|
+
});
|
167
|
+
}
|
168
|
+
function decorateMenuItems() {
|
169
|
+
var menuAreas = areas[keyMap.MENU_AREA_KEY];
|
170
|
+
if (!menuAreas) {
|
171
|
+
return;
|
172
|
+
}
|
173
|
+
Array.from(menuAreas).forEach((menu) => {
|
174
|
+
var $menu = $(menu);
|
175
|
+
var menuItems = $menu.children("li.k-item");
|
176
|
+
Array.from(menuItems).forEach((menuItem) => {
|
177
|
+
var $menuItem = $(menuItem);
|
178
|
+
if (!$menuItem.hasClass("trv-report-pager")) {
|
179
|
+
var ariaLabel = $menuItem.attr("aria-label");
|
180
|
+
var expandableSr = utils.stringFormat(". {0}", [stringResources.stringResources.ariaLabelExpandable]);
|
181
|
+
var expandable = $menuItem.find("ul").length > 0 && ariaLabel.indexOf(expandableSr) < 0 ? expandableSr : "";
|
182
|
+
var selectedSr = utils.stringFormat(". {0}", [stringResources.stringResources.ariaLabelSelected]);
|
183
|
+
var selected = $menuItem.hasClass("k-selected") && ariaLabel.indexOf(selectedSr) < 0 ? selectedSr : "";
|
184
|
+
var label = ariaLabel + expandable + selected;
|
185
|
+
$menuItem.attr("aria-label", label);
|
186
|
+
if ($menuItem.hasClass("k-disabled")) {
|
187
|
+
$menuItem.attr("aria-disabled", "true");
|
188
|
+
} else {
|
189
|
+
$menuItem.removeAttr("aria-disabled");
|
190
|
+
}
|
191
|
+
}
|
192
|
+
});
|
193
|
+
});
|
194
|
+
}
|
195
|
+
function setKeyMap(keyMapValues) {
|
196
|
+
keyMap = keyMapValues;
|
197
|
+
areas = void 0;
|
198
|
+
}
|
199
|
+
function getKeyMap() {
|
200
|
+
return keyMap;
|
201
|
+
}
|
202
|
+
return {
|
203
|
+
getKeyMap,
|
204
|
+
setKeyMap
|
205
|
+
};
|
206
|
+
}
|
207
|
+
|
208
|
+
exports.Accessibility = Accessibility;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var __defProp = Object.defineProperty;
|
6
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
7
|
+
var __publicField = (obj, key, value) => {
|
8
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
9
|
+
return value;
|
10
|
+
};
|
11
|
+
class BaseComponent {
|
12
|
+
// #endregion
|
13
|
+
// #region constructor
|
14
|
+
constructor(element, options) {
|
15
|
+
// #region fields
|
16
|
+
__publicField(this, "element");
|
17
|
+
__publicField(this, "$element");
|
18
|
+
__publicField(this, "options");
|
19
|
+
this.element = element;
|
20
|
+
this.$element = $(element);
|
21
|
+
this.options = options;
|
22
|
+
}
|
23
|
+
// #endregion
|
24
|
+
}
|
25
|
+
|
26
|
+
exports.BaseComponent = BaseComponent;
|
@@ -0,0 +1,79 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var globalSettings = require('./globalSettings.js');
|
6
|
+
|
7
|
+
class Binder {
|
8
|
+
static bind($element, ...args) {
|
9
|
+
const commands = args[0].commands;
|
10
|
+
const viewerOptions = args[1];
|
11
|
+
Binder.attachCommands($element, commands, viewerOptions);
|
12
|
+
var plugins = $element.find('[data-role^="telerik_ReportViewer_"]');
|
13
|
+
Array.from(plugins).forEach((element) => {
|
14
|
+
var $element2 = $(element);
|
15
|
+
var fn = $.fn[$element2.attr("data-role")];
|
16
|
+
if (typeof fn === "function") {
|
17
|
+
fn.apply($element2, args);
|
18
|
+
}
|
19
|
+
});
|
20
|
+
}
|
21
|
+
static attachCommands($element, commands, viewerOptions) {
|
22
|
+
var elementSelector = '[data-command^="telerik_ReportViewer_"]';
|
23
|
+
var customElementSelector = "[data-target-report-viewer]" + elementSelector;
|
24
|
+
$element.on("click", elementSelector, commandHandler);
|
25
|
+
if (!globalSettings.GlobalSettings.CommandHandlerAttached) {
|
26
|
+
$(document.body).on("click", customElementSelector, customCommandHandler);
|
27
|
+
globalSettings.GlobalSettings.CommandHandlerAttached = true;
|
28
|
+
}
|
29
|
+
Object.entries(commands).forEach(([key, command]) => {
|
30
|
+
attachCommand(key, command, viewerOptions, $element);
|
31
|
+
});
|
32
|
+
function commandHandler(event) {
|
33
|
+
var prefixedDataCommand = $(this).attr("data-command");
|
34
|
+
if (prefixedDataCommand) {
|
35
|
+
var dataCommand = prefixedDataCommand.substring("telerik_ReportViewer_".length);
|
36
|
+
var cmd = commands[dataCommand];
|
37
|
+
if (cmd && cmd.enabled()) {
|
38
|
+
cmd.exec($(this).attr("data-command-parameter"));
|
39
|
+
}
|
40
|
+
event.preventDefault();
|
41
|
+
}
|
42
|
+
}
|
43
|
+
function customCommandHandler(event) {
|
44
|
+
var $this = $(this);
|
45
|
+
var prefixedDataCommand = $this.attr("data-command");
|
46
|
+
var reportViewerTarget = $this.attr("data-target-report-viewer");
|
47
|
+
if (prefixedDataCommand && reportViewerTarget) {
|
48
|
+
var dataCommand = prefixedDataCommand.substring("telerik_ReportViewer_".length);
|
49
|
+
var reportViewer = $(reportViewerTarget).data("telerik_ReportViewer");
|
50
|
+
var cmd = reportViewer.commands[dataCommand];
|
51
|
+
if (cmd.enabled()) {
|
52
|
+
cmd.exec($(this).attr("data-command-parameter"));
|
53
|
+
}
|
54
|
+
event.preventDefault();
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
function attachCommand(dataCommand, cmd, viewerOptions, $element) {
|
60
|
+
if (cmd) {
|
61
|
+
var elementSelector = '[data-command="telerik_ReportViewer_' + dataCommand + '"]';
|
62
|
+
var customElementSelector = '[data-target-report-viewer="' + viewerOptions.selector + '"]' + elementSelector;
|
63
|
+
var $defaultElement = $element.find(elementSelector);
|
64
|
+
var $customElement = $(customElementSelector);
|
65
|
+
$(cmd).on("enabledChanged", function(event) {
|
66
|
+
(cmd.enabled() ? $.fn.removeClass : $.fn.addClass).call($defaultElement.parent("li"), "k-disabled");
|
67
|
+
(cmd.enabled() ? $.fn.removeClass : $.fn.addClass).call($customElement, viewerOptions.disabledButtonClass);
|
68
|
+
}).on("checkedChanged", function(event) {
|
69
|
+
var defaultTarget = $defaultElement.parent("li");
|
70
|
+
(cmd.checked() ? $.fn.addClass : $.fn.removeClass).call(defaultTarget, getSelectedClassName(defaultTarget));
|
71
|
+
(cmd.checked() ? $.fn.addClass : $.fn.removeClass).call($customElement, viewerOptions.checkedButtonClass);
|
72
|
+
});
|
73
|
+
}
|
74
|
+
}
|
75
|
+
function getSelectedClassName($element) {
|
76
|
+
return $element.hasClass("trv-menu-toggleable") ? "k-selected !k-bg-primary" : "k-selected";
|
77
|
+
}
|
78
|
+
|
79
|
+
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;
|