@progress/telerik-jquery-report-viewer 22.24.514 → 23.24.806
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 +28 -38
- package/dist/cjs/base-component.js +26 -0
- package/dist/cjs/binder.js +45 -138
- package/dist/cjs/controller.js +25 -25
- package/dist/cjs/documentMapArea.js +4 -13
- package/dist/cjs/event-emitter.js +124 -10
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/mainMenu.js +22 -31
- package/dist/cjs/pagesArea.js +8 -27
- package/dist/cjs/parameterValidators.js +4 -7
- package/dist/cjs/parameters.js +13 -13
- package/dist/cjs/parametersArea.js +36 -49
- package/dist/cjs/print.js +3 -4
- package/dist/cjs/reportViewer.js +38 -27
- package/dist/cjs/scroll.js +4 -6
- package/dist/cjs/search.js +327 -377
- package/dist/cjs/sendEmail.js +52 -95
- package/dist/cjs/serviceClient.js +163 -257
- package/dist/cjs/sideMenu.js +15 -24
- package/dist/cjs/sr.js +4 -4
- package/dist/cjs/template-cache.js +6 -6
- 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/uiFreezeCoordinator.js +17 -16
- package/dist/cjs/utils.js +11 -14
- package/dist/es/accessibility.js +29 -39
- package/dist/es/base-component.js +22 -0
- package/dist/es/binder.js +45 -138
- package/dist/es/controller.js +26 -26
- package/dist/es/documentMapArea.js +4 -13
- package/dist/es/event-emitter.js +124 -10
- package/dist/es/index.js +1 -0
- package/dist/es/mainMenu.js +23 -32
- package/dist/es/pagesArea.js +9 -28
- package/dist/es/parameterValidators.js +5 -8
- package/dist/es/parameters.js +14 -14
- package/dist/es/parametersArea.js +37 -50
- package/dist/es/print.js +4 -5
- package/dist/es/reportViewer.js +39 -28
- package/dist/es/scroll.js +4 -6
- package/dist/es/search.js +328 -378
- package/dist/es/sendEmail.js +52 -95
- package/dist/es/serviceClient.js +164 -258
- package/dist/es/sideMenu.js +16 -25
- package/dist/es/sr.js +4 -4
- package/dist/es/template-cache.js +7 -7
- 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/uiFreezeCoordinator.js +17 -16
- package/dist/es/utils.js +11 -14
- package/dist/font/font-icons.css +4 -4
- package/dist/font/font-icons.min.css +3 -3
- package/dist/js/telerikReportViewer.js +1080 -1190
- package/dist/js/telerikReportViewer.min.js +1 -1
- package/dist/js/telerikReportViewer.stringResources.js +4 -4
- 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 +3 -2
- /package/dist/font/{ReportingIcons-18.1.24.514.ttf → ReportingIcons-18.2.24.806.ttf} +0 -0
package/dist/es/binder.js
CHANGED
@@ -1,56 +1,54 @@
|
|
1
|
-
import { each, tryParseInt, isSpecialKey } from './utils.js';
|
2
1
|
import { GlobalSettings } from './globalSettings.js';
|
3
2
|
|
4
|
-
|
5
|
-
bind
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
var
|
12
|
-
|
13
|
-
|
3
|
+
class Binder {
|
4
|
+
static bind($element, ...args) {
|
5
|
+
const commands = args[0].commands;
|
6
|
+
const viewerOptions = args[1];
|
7
|
+
Binder.attachCommands($element, commands, viewerOptions);
|
8
|
+
var plugins = $element.find('[data-role^="telerik_ReportViewer_"]');
|
9
|
+
Array.from(plugins).forEach((element) => {
|
10
|
+
var $element2 = $(element);
|
11
|
+
var fn = $.fn[$element2.attr("data-role")];
|
12
|
+
if (typeof fn === "function") {
|
13
|
+
fn.apply($element2, args);
|
14
14
|
}
|
15
15
|
});
|
16
16
|
}
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
cmd.exec($(this).attr("data-command-parameter"));
|
17
|
+
static attachCommands($element, commands, viewerOptions) {
|
18
|
+
var elementSelector = '[data-command^="telerik_ReportViewer_"]';
|
19
|
+
var customElementSelector = "[data-target-report-viewer]" + elementSelector;
|
20
|
+
$element.on("click", elementSelector, commandHandler);
|
21
|
+
if (!GlobalSettings.CommandHandlerAttached) {
|
22
|
+
$(document.body).on("click", customElementSelector, customCommandHandler);
|
23
|
+
GlobalSettings.CommandHandlerAttached = true;
|
24
|
+
}
|
25
|
+
Object.entries(commands).forEach(([key, command]) => {
|
26
|
+
attachCommand(key, command, viewerOptions, $element);
|
27
|
+
});
|
28
|
+
function commandHandler(event) {
|
29
|
+
var prefixedDataCommand = $(this).attr("data-command");
|
30
|
+
if (prefixedDataCommand) {
|
31
|
+
var dataCommand = prefixedDataCommand.substring("telerik_ReportViewer_".length);
|
32
|
+
var cmd = commands[dataCommand];
|
33
|
+
if (cmd && cmd.enabled()) {
|
34
|
+
cmd.exec($(this).attr("data-command-parameter"));
|
35
|
+
}
|
36
|
+
event.preventDefault();
|
38
37
|
}
|
39
|
-
e.preventDefault();
|
40
38
|
}
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
39
|
+
function customCommandHandler(event) {
|
40
|
+
var $this = $(this);
|
41
|
+
var prefixedDataCommand = $this.attr("data-command");
|
42
|
+
var reportViewerTarget = $this.attr("data-target-report-viewer");
|
43
|
+
if (prefixedDataCommand && reportViewerTarget) {
|
44
|
+
var dataCommand = prefixedDataCommand.substring("telerik_ReportViewer_".length);
|
45
|
+
var reportViewer = $(reportViewerTarget).data("telerik_ReportViewer");
|
46
|
+
var cmd = reportViewer.commands[dataCommand];
|
47
|
+
if (cmd.enabled()) {
|
48
|
+
cmd.exec($(this).attr("data-command-parameter"));
|
49
|
+
}
|
50
|
+
event.preventDefault();
|
52
51
|
}
|
53
|
-
e.preventDefault();
|
54
52
|
}
|
55
53
|
}
|
56
54
|
}
|
@@ -60,10 +58,10 @@ function attachCommand(dataCommand, cmd, viewerOptions, $element) {
|
|
60
58
|
var customElementSelector = '[data-target-report-viewer="' + viewerOptions.selector + '"]' + elementSelector;
|
61
59
|
var $defaultElement = $element.find(elementSelector);
|
62
60
|
var $customElement = $(customElementSelector);
|
63
|
-
$(cmd).on("enabledChanged", function(
|
61
|
+
$(cmd).on("enabledChanged", function(event) {
|
64
62
|
(cmd.enabled() ? $.fn.removeClass : $.fn.addClass).call($defaultElement.parent("li"), "k-disabled");
|
65
63
|
(cmd.enabled() ? $.fn.removeClass : $.fn.addClass).call($customElement, viewerOptions.disabledButtonClass);
|
66
|
-
}).on("checkedChanged", function(
|
64
|
+
}).on("checkedChanged", function(event) {
|
67
65
|
var defaultTarget = $defaultElement.parent("li");
|
68
66
|
(cmd.checked() ? $.fn.addClass : $.fn.removeClass).call(defaultTarget, getSelectedClassName(defaultTarget));
|
69
67
|
(cmd.checked() ? $.fn.addClass : $.fn.removeClass).call($customElement, viewerOptions.checkedButtonClass);
|
@@ -73,96 +71,5 @@ function attachCommand(dataCommand, cmd, viewerOptions, $element) {
|
|
73
71
|
function getSelectedClassName($element) {
|
74
72
|
return $element.hasClass("trv-menu-toggleable") ? "k-selected !k-bg-primary" : "k-selected";
|
75
73
|
}
|
76
|
-
function LinkButton(dom, options) {
|
77
|
-
var cmd;
|
78
|
-
var $element = $(dom);
|
79
|
-
var dataCommand = $element.attr("data-command");
|
80
|
-
if (dataCommand) {
|
81
|
-
cmd = options.commands[dataCommand];
|
82
|
-
}
|
83
|
-
if (cmd) {
|
84
|
-
$element.click(function(e) {
|
85
|
-
if (cmd.enabled()) {
|
86
|
-
cmd.exec($(this).attr("data-command-parameter"));
|
87
|
-
} else {
|
88
|
-
e.preventDefault();
|
89
|
-
}
|
90
|
-
});
|
91
|
-
$(cmd).on("enabledChanged", function(e) {
|
92
|
-
(cmd.enabled() ? $.fn.removeClass : $.fn.addClass).call($element, "disabled");
|
93
|
-
}).on("checkedChanged", function(e) {
|
94
|
-
(cmd.checked() ? $.fn.addClass : $.fn.removeClass).call($element, "checked");
|
95
|
-
});
|
96
|
-
}
|
97
|
-
}
|
98
|
-
var linkButton_pluginName = "telerik_ReportViewer_LinkButton";
|
99
|
-
$.fn[linkButton_pluginName] = function(options) {
|
100
|
-
return each(this, function() {
|
101
|
-
if (!$.data(this, linkButton_pluginName)) {
|
102
|
-
$.data(this, linkButton_pluginName, new LinkButton(this, options));
|
103
|
-
}
|
104
|
-
});
|
105
|
-
};
|
106
|
-
function PageNumberInput(dom, options) {
|
107
|
-
var $element = $(dom);
|
108
|
-
var oldValue = 0;
|
109
|
-
var cmd = options.commands["goToPage"];
|
110
|
-
function setPageNumber(value) {
|
111
|
-
if (oldValue !== value || !$element.is(":focus")) {
|
112
|
-
$element.val(value);
|
113
|
-
oldValue = value;
|
114
|
-
}
|
115
|
-
}
|
116
|
-
options.controller.pageNumberChange(function(e, value) {
|
117
|
-
setPageNumber(value);
|
118
|
-
});
|
119
|
-
$element.change(function() {
|
120
|
-
var val = $(this).val();
|
121
|
-
var num = tryParseInt(val);
|
122
|
-
if (!isNaN(num)) {
|
123
|
-
var result = cmd.exec(num);
|
124
|
-
setPageNumber(result);
|
125
|
-
}
|
126
|
-
});
|
127
|
-
$element.keydown(function(e) {
|
128
|
-
if (e.which == 13) {
|
129
|
-
$(this).change();
|
130
|
-
return e.preventDefault();
|
131
|
-
}
|
132
|
-
});
|
133
|
-
function validateValue(value) {
|
134
|
-
return /^([0-9]+)$/.test(value);
|
135
|
-
}
|
136
|
-
$element.keypress(function(event) {
|
137
|
-
if (isSpecialKey(event.keyCode)) {
|
138
|
-
return true;
|
139
|
-
}
|
140
|
-
var newValue = $element.val() + String.fromCharCode(event.charCode);
|
141
|
-
return validateValue(newValue);
|
142
|
-
}).on("paste", function(event) {
|
143
|
-
});
|
144
|
-
}
|
145
|
-
var pageNumberInput_pluginName = "telerik_ReportViewer_PageNumberInput";
|
146
|
-
$.fn[pageNumberInput_pluginName] = function(options) {
|
147
|
-
return each(this, function() {
|
148
|
-
if (!$.data(this, pageNumberInput_pluginName)) {
|
149
|
-
$.data(this, pageNumberInput_pluginName, new PageNumberInput(this, options));
|
150
|
-
}
|
151
|
-
});
|
152
|
-
};
|
153
|
-
function PageCountLabel(dom, options) {
|
154
|
-
var $element = $(dom);
|
155
|
-
options.controller.pageCountChange(function(e, value) {
|
156
|
-
$element.text(value);
|
157
|
-
});
|
158
|
-
}
|
159
|
-
var pageCountLabel_pluginName = "telerik_ReportViewer_PageCountLabel";
|
160
|
-
$.fn[pageCountLabel_pluginName] = function(options) {
|
161
|
-
return each(this, function() {
|
162
|
-
if (!$.data(this, pageCountLabel_pluginName)) {
|
163
|
-
$.data(this, pageCountLabel_pluginName, new PageCountLabel(this, options));
|
164
|
-
}
|
165
|
-
});
|
166
|
-
};
|
167
74
|
|
168
75
|
export { Binder };
|
package/dist/es/controller.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { tryParseInt, logError, isInvalidClientException, isInternalServerError, isApplicationException, getExceptionInstance, stringFormat, parseJSON, escapeHtml, isSystemArgumentException, exceptionTypeNamesMatch, isSvgSupported } from './utils.js';
|
2
2
|
import { stringResources } from './stringResources.js';
|
3
3
|
import { PrintManager } from './print.js';
|
4
4
|
import { ParameterValidators } from './parameterValidators.js';
|
@@ -34,7 +34,7 @@ function ReportViewerController(options) {
|
|
34
34
|
var eventEmitter = new EventEmitter();
|
35
35
|
var serviceClientSentinel;
|
36
36
|
clearReportState();
|
37
|
-
options = extend({}, defaultOptions, options);
|
37
|
+
options = $.extend({}, defaultOptions, options);
|
38
38
|
var settings = options.settings;
|
39
39
|
if (typeof settings.getPrintMode === "function") {
|
40
40
|
printMode = settings.getPrintMode();
|
@@ -173,18 +173,16 @@ function ReportViewerController(options) {
|
|
173
173
|
return client.getDocumentInfo(clientId2, instanceId, documentId).catch(handleRequestError).then(function(info) {
|
174
174
|
if (info && info.documentReady) {
|
175
175
|
return info;
|
176
|
-
} else {
|
177
|
-
info["promise"] = new Promise(function(resolve, reject) {
|
178
|
-
window.setTimeout(resolve, options2.documentInfoPollIntervalMs);
|
179
|
-
}).then(function() {
|
180
|
-
return getDocumentInfoRecursive(clientId2, instanceId, documentId, options2);
|
181
|
-
});
|
182
|
-
return info;
|
183
176
|
}
|
177
|
+
info["promise"] = new Promise(function(resolve, reject) {
|
178
|
+
window.setTimeout(resolve, options2.documentInfoPollIntervalMs);
|
179
|
+
}).then(function() {
|
180
|
+
return getDocumentInfoRecursive(clientId2, instanceId, documentId, options2);
|
181
|
+
});
|
182
|
+
return info;
|
184
183
|
});
|
185
|
-
} else {
|
186
|
-
return Promise.reject();
|
187
184
|
}
|
185
|
+
return Promise.reject();
|
188
186
|
}
|
189
187
|
function ReportLoader(reportHost, useCache, baseDocumentId, actionId) {
|
190
188
|
var loaderOptions = {};
|
@@ -542,7 +540,7 @@ function ReportViewerController(options) {
|
|
542
540
|
if (typeof args[0] === "function") {
|
543
541
|
eventEmitter.on(event, args[0]);
|
544
542
|
} else {
|
545
|
-
eventEmitter.trigger(event, args);
|
543
|
+
eventEmitter.trigger(event, ...args);
|
546
544
|
}
|
547
545
|
return controller;
|
548
546
|
}
|
@@ -571,11 +569,10 @@ function ReportViewerController(options) {
|
|
571
569
|
var node = nodes[i];
|
572
570
|
if (node.id === id) {
|
573
571
|
return node.page;
|
574
|
-
}
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
}
|
572
|
+
}
|
573
|
+
var page = getPageForBookmark(node.items, id);
|
574
|
+
if (page) {
|
575
|
+
return page;
|
579
576
|
}
|
580
577
|
}
|
581
578
|
}
|
@@ -752,7 +749,7 @@ function ReportViewerController(options) {
|
|
752
749
|
MISSING_OR_INVALID_PARAMETERS: "missingOrInvalidParameters",
|
753
750
|
RENDERING_STOPPED: "renderingStopped"
|
754
751
|
};
|
755
|
-
extend(
|
752
|
+
$.extend(
|
756
753
|
controller,
|
757
754
|
{
|
758
755
|
getPageData: function(pageNumber) {
|
@@ -767,7 +764,7 @@ function ReportViewerController(options) {
|
|
767
764
|
}
|
768
765
|
return {
|
769
766
|
report,
|
770
|
-
parameters: extend({}, parameterValues)
|
767
|
+
parameters: $.extend({}, parameterValues)
|
771
768
|
};
|
772
769
|
},
|
773
770
|
setReportSource: function(rs) {
|
@@ -783,7 +780,7 @@ function ReportViewerController(options) {
|
|
783
780
|
return this;
|
784
781
|
},
|
785
782
|
updateSettings: function(settings2) {
|
786
|
-
options.settings = extend({}, settings2, options.settings);
|
783
|
+
options.settings = $.extend({}, settings2, options.settings);
|
787
784
|
},
|
788
785
|
clearReportSource: function() {
|
789
786
|
report = parameterValues = null;
|
@@ -894,6 +891,9 @@ function ReportViewerController(options) {
|
|
894
891
|
});
|
895
892
|
},
|
896
893
|
getReportParameters: function() {
|
894
|
+
if (!parameterValues) {
|
895
|
+
return [];
|
896
|
+
}
|
897
897
|
var paramsToBeExposed = {};
|
898
898
|
for (var key in processedParameterValues) {
|
899
899
|
var processedParam = processedParameterValues[key];
|
@@ -925,13 +925,13 @@ function ReportViewerController(options) {
|
|
925
925
|
var parameterValues2 = {};
|
926
926
|
var invalidParameters = [];
|
927
927
|
var hasError = false;
|
928
|
-
|
928
|
+
Array.from(parameters || []).forEach((parameter) => {
|
929
929
|
try {
|
930
|
-
var value = parameterValidators.validate(
|
931
|
-
parameterValues2[
|
930
|
+
var value = parameterValidators.validate(parameter, parameter.value);
|
931
|
+
parameterValues2[parameter.id] = value;
|
932
932
|
} catch (e) {
|
933
933
|
hasError = true;
|
934
|
-
invalidParameters.push(
|
934
|
+
invalidParameters.push(parameter);
|
935
935
|
return;
|
936
936
|
}
|
937
937
|
});
|
@@ -1008,8 +1008,8 @@ function ReportViewerController(options) {
|
|
1008
1008
|
eventEmitter.on(eventName, handler);
|
1009
1009
|
return controller;
|
1010
1010
|
},
|
1011
|
-
trigger: function(eventName, args) {
|
1012
|
-
eventEmitter.trigger(eventName, args);
|
1011
|
+
trigger: function(eventName, ...args) {
|
1012
|
+
eventEmitter.trigger(eventName, ...args);
|
1013
1013
|
return controller;
|
1014
1014
|
},
|
1015
1015
|
showNotification: function(...args) {
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { each } from './utils.js';
|
2
1
|
import { stringResources } from './stringResources.js';
|
3
2
|
import { DocumentMapAreaPositions } from './enums.js';
|
4
3
|
import { GlobalSettings } from './globalSettings.js';
|
@@ -41,8 +40,8 @@ function DocumentMapArea(placeholder, options, otherOptions) {
|
|
41
40
|
}
|
42
41
|
function setNodeAccessibilityAttributes(node) {
|
43
42
|
var $items = $(node).find("li");
|
44
|
-
|
45
|
-
var $li = $(
|
43
|
+
Array.from($items).forEach((item) => {
|
44
|
+
var $li = $(item);
|
46
45
|
$li.attr("aria-label", $li[0].innerText);
|
47
46
|
});
|
48
47
|
}
|
@@ -74,8 +73,8 @@ function DocumentMapArea(placeholder, options, otherOptions) {
|
|
74
73
|
treeView.bind("expand", onTreeViewNodeExpand);
|
75
74
|
treeView.element.attr("aria-label", stringResources.ariaLabelDocumentMap);
|
76
75
|
var listItems = treeView.element.find("ul");
|
77
|
-
|
78
|
-
setNodeAccessibilityAttributes(
|
76
|
+
Array.from(listItems).forEach((list) => {
|
77
|
+
setNodeAccessibilityAttributes(list);
|
79
78
|
});
|
80
79
|
if (documentMapNecessary) {
|
81
80
|
setSplitbarAccessibilityAttributes();
|
@@ -152,13 +151,5 @@ function DocumentMapArea(placeholder, options, otherOptions) {
|
|
152
151
|
$documentMapOverlay.attr("aria-label", stringResources[$documentMapOverlay.attr("aria-label")]);
|
153
152
|
}
|
154
153
|
}
|
155
|
-
var pluginName = "telerik_ReportViewer_DocumentMapArea";
|
156
|
-
$.fn[pluginName] = function(options, otherOptions) {
|
157
|
-
return each(this, function() {
|
158
|
-
if (!$.data(this, pluginName)) {
|
159
|
-
$.data(this, pluginName, new DocumentMapArea(this, options, otherOptions));
|
160
|
-
}
|
161
|
-
});
|
162
|
-
};
|
163
154
|
|
164
155
|
export { DocumentMapArea };
|
package/dist/es/event-emitter.js
CHANGED
@@ -1,13 +1,127 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
3
|
+
var __publicField = (obj, key, value) => {
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
5
|
+
return value;
|
6
|
+
};
|
7
|
+
class EventEmitter extends EventTarget {
|
8
|
+
constructor() {
|
9
|
+
super();
|
10
|
+
__publicField(this, "_events");
|
11
|
+
__publicField(this, "_eventsCount");
|
12
|
+
this._events = {};
|
13
|
+
this._eventsCount = 0;
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* @param {string} type
|
17
|
+
* @param {(event: CustomEvent, ...args: any[]) => void} listener
|
18
|
+
* @returns
|
19
|
+
*/
|
20
|
+
addListener(type, listener) {
|
21
|
+
if (typeof listener !== "function") {
|
22
|
+
throw new TypeError("listener must be a function");
|
23
|
+
}
|
24
|
+
if (!this._events[type]) {
|
25
|
+
this._events[type] = [];
|
26
|
+
}
|
27
|
+
function wrappedListener(event) {
|
28
|
+
listener.call(this, event, ...event.detail);
|
29
|
+
}
|
30
|
+
wrappedListener.listener = listener;
|
31
|
+
this._events[type].push(wrappedListener);
|
32
|
+
this._eventsCount++;
|
33
|
+
this.addEventListener(type, wrappedListener.bind(this));
|
34
|
+
return this;
|
35
|
+
}
|
36
|
+
/**
|
37
|
+
* @alias addListener
|
38
|
+
* @param {string} type
|
39
|
+
* @param {(event: CustomEvent, ...args: any[]) => void} listener
|
40
|
+
* @returns
|
41
|
+
*/
|
42
|
+
on(type, listener) {
|
43
|
+
return this.addListener(type, listener);
|
44
|
+
}
|
45
|
+
/**
|
46
|
+
* @param {string} type
|
47
|
+
* @param {any[]} args
|
48
|
+
* @returns
|
49
|
+
*/
|
50
|
+
trigger(type, ...args) {
|
51
|
+
if (!this._events[type]) {
|
52
|
+
return void 0;
|
53
|
+
}
|
54
|
+
const event = new CustomEvent(type, {
|
55
|
+
detail: args,
|
56
|
+
cancelable: true
|
57
|
+
});
|
58
|
+
return this.dispatchEvent(event);
|
59
|
+
}
|
60
|
+
/**
|
61
|
+
* @alias trigger
|
62
|
+
* @param {string} type
|
63
|
+
* @param {any[]} args
|
64
|
+
* @returns
|
65
|
+
*/
|
66
|
+
emit(type, ...args) {
|
67
|
+
return this.trigger(type, ...args);
|
68
|
+
}
|
69
|
+
/**
|
70
|
+
* @param {string} type
|
71
|
+
* @param {(event: CustomEvent, ...args: any[]) => void} listener
|
72
|
+
* @returns
|
73
|
+
*/
|
74
|
+
removeListener(type, listener) {
|
75
|
+
if (!this._events[type]) {
|
76
|
+
return this;
|
77
|
+
}
|
78
|
+
this._events[type] = this._events[type].filter((wrappedListener) => {
|
79
|
+
if (wrappedListener.listener !== listener) {
|
80
|
+
return true;
|
81
|
+
}
|
82
|
+
this.removeEventListener(type, wrappedListener);
|
83
|
+
return false;
|
84
|
+
});
|
85
|
+
if (this._events[type].length === 0) {
|
86
|
+
delete this._events[type];
|
87
|
+
this._eventsCount--;
|
88
|
+
}
|
89
|
+
return this;
|
90
|
+
}
|
91
|
+
/**
|
92
|
+
* @param {string} type
|
93
|
+
* @returns
|
94
|
+
*/
|
95
|
+
removeAllListeners(type) {
|
96
|
+
if (type === void 0) {
|
97
|
+
Object.keys(this._events).forEach((eventType) => {
|
98
|
+
this.removeAllListeners(eventType);
|
99
|
+
});
|
100
|
+
return this;
|
101
|
+
}
|
102
|
+
if (this._events[type]) {
|
103
|
+
this._events[type].forEach((wrappedListener) => {
|
104
|
+
this.removeEventListener(type, wrappedListener);
|
105
|
+
});
|
106
|
+
delete this._events[type];
|
107
|
+
this._eventsCount--;
|
108
|
+
}
|
109
|
+
return this;
|
110
|
+
}
|
111
|
+
/**
|
112
|
+
* @param {string} type
|
113
|
+
* @param {(event: CustomEvent, ...args: any[]) => void} listener
|
114
|
+
* @returns
|
115
|
+
*/
|
116
|
+
off(type, listener) {
|
117
|
+
if (type === void 0) {
|
118
|
+
return this.removeAllListeners();
|
119
|
+
}
|
120
|
+
if (listener === void 0) {
|
121
|
+
return this.removeAllListeners(type);
|
122
|
+
}
|
123
|
+
return this.removeListener(type, listener);
|
124
|
+
}
|
11
125
|
}
|
12
126
|
|
13
127
|
export { EventEmitter };
|
package/dist/es/index.js
CHANGED
package/dist/es/mainMenu.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { tryParseInt, stringFormat } from './utils.js';
|
2
2
|
import { stringResources } from './stringResources.js';
|
3
3
|
|
4
4
|
var lastSelectedMenuItem;
|
@@ -44,9 +44,9 @@ function MainMenu(dom, rootOptions, otherOptions) {
|
|
44
44
|
replaceStringResources();
|
45
45
|
}
|
46
46
|
function setTabIndexes() {
|
47
|
-
var $menus =
|
48
|
-
|
49
|
-
var $menuArea = $(
|
47
|
+
var $menus = $('[data-role="telerik_ReportViewer_MainMenu"]');
|
48
|
+
Array.from($menus).forEach((menu2) => {
|
49
|
+
var $menuArea = $(menu2);
|
50
50
|
var listItems = $menuArea.find("li");
|
51
51
|
var menuTabIndex = 0;
|
52
52
|
var tabIndexAttr = $menuArea.attr("tabIndex");
|
@@ -64,13 +64,13 @@ function MainMenu(dom, rootOptions, otherOptions) {
|
|
64
64
|
});
|
65
65
|
}
|
66
66
|
function setMenuItemsTabIndexes(listItems, menuTabIndex) {
|
67
|
-
|
68
|
-
var $item = $(
|
67
|
+
Array.from(listItems).forEach((item) => {
|
68
|
+
var $item = $(item);
|
69
69
|
$item.attr("tabindex", menuTabIndex);
|
70
|
-
$item.focus(
|
70
|
+
$item.on("focus", (event) => {
|
71
71
|
$item.addClass("k-focus");
|
72
72
|
});
|
73
|
-
$item.blur(
|
73
|
+
$item.on("blur", (event) => {
|
74
74
|
$item.removeClass("k-focus");
|
75
75
|
});
|
76
76
|
var anchor = $item.children("a");
|
@@ -89,16 +89,15 @@ function MainMenu(dom, rootOptions, otherOptions) {
|
|
89
89
|
});
|
90
90
|
}
|
91
91
|
function fillFormats(formats) {
|
92
|
-
|
93
|
-
var $list = $(
|
92
|
+
Array.from($(dom).find("ul[data-command-list=export-format-list]")).forEach((list) => {
|
93
|
+
var $list = $(list);
|
94
94
|
var $parent = $list.parents("li");
|
95
95
|
var tabIndex = enableAccessibility ? $parent.attr("tabindex") : -1;
|
96
96
|
if (!tabIndex) {
|
97
97
|
tabIndex = 1;
|
98
98
|
}
|
99
99
|
$list.empty();
|
100
|
-
|
101
|
-
var format = this;
|
100
|
+
Array.from(formats).forEach((format) => {
|
102
101
|
var ariaLabel = enableAccessibility ? stringFormat('aria-label="{localizedName}" ', format) : " ";
|
103
102
|
var li = "<li " + ariaLabel + stringFormat('tabindex="' + tabIndex + '"><a tabindex="-1" href="#" data-command="telerik_ReportViewer_export" data-command-parameter="{name}"><span>{localizedName}</span></a></li>', format);
|
104
103
|
menu.append(li, $parent);
|
@@ -109,10 +108,10 @@ function MainMenu(dom, rootOptions, otherOptions) {
|
|
109
108
|
});
|
110
109
|
}
|
111
110
|
function setInternalListAccessibilityKeyEvents(listItems) {
|
112
|
-
|
113
|
-
var $item = $(
|
111
|
+
Array.from(listItems).forEach((item) => {
|
112
|
+
var $item = $(item);
|
114
113
|
$item.off("keydown");
|
115
|
-
$item.on("keydown",
|
114
|
+
$item.on("keydown", (event) => {
|
116
115
|
switch (event.which) {
|
117
116
|
case kendo.keys.ENTER:
|
118
117
|
clickOnMenuItem($item);
|
@@ -120,17 +119,17 @@ function MainMenu(dom, rootOptions, otherOptions) {
|
|
120
119
|
case kendo.keys.UP:
|
121
120
|
var $prev = $item.prev();
|
122
121
|
if ($prev.length > 0) {
|
123
|
-
$prev.focus
|
122
|
+
$prev.trigger("focus");
|
124
123
|
} else {
|
125
|
-
$item.parents("li").focus
|
124
|
+
$item.parents("li").trigger("focus");
|
126
125
|
}
|
127
126
|
break;
|
128
127
|
case kendo.keys.DOWN:
|
129
128
|
var $next = $item.next();
|
130
129
|
if ($next.length > 0) {
|
131
|
-
$next.focus
|
130
|
+
$next.trigger("focus");
|
132
131
|
} else {
|
133
|
-
$item.parent().children("li").first().focus
|
132
|
+
$item.parent().children("li").first().trigger("focus");
|
134
133
|
}
|
135
134
|
break;
|
136
135
|
}
|
@@ -294,12 +293,12 @@ function MainMenu(dom, rootOptions, otherOptions) {
|
|
294
293
|
if (!menuAreas) {
|
295
294
|
return;
|
296
295
|
}
|
297
|
-
|
298
|
-
var $menu = $(
|
296
|
+
Array.from(menuAreas).forEach((menu2) => {
|
297
|
+
var $menu = $(menu2);
|
299
298
|
var menuItems = $menu.children("li.k-item");
|
300
299
|
$menu.attr("aria-label", stringResources[$menu.attr("aria-label")]);
|
301
|
-
|
302
|
-
var $menuItem = $(
|
300
|
+
Array.from(menuItems).forEach((menuItem) => {
|
301
|
+
var $menuItem = $(menuItem);
|
303
302
|
$menuItem.attr("aria-label", stringResources[$menuItem.attr("aria-label")]);
|
304
303
|
if (!$menuItem.hasClass("trv-report-pager")) {
|
305
304
|
var $a = $menuItem.find("a");
|
@@ -313,16 +312,8 @@ function MainMenu(dom, rootOptions, otherOptions) {
|
|
313
312
|
});
|
314
313
|
}
|
315
314
|
function findMenuArea() {
|
316
|
-
return
|
315
|
+
return $("ul[data-role=telerik_ReportViewer_MainMenu]");
|
317
316
|
}
|
318
317
|
}
|
319
|
-
var pluginName = "telerik_ReportViewer_MainMenu";
|
320
|
-
$.fn[pluginName] = function(options, otherOptions) {
|
321
|
-
return each(this, function() {
|
322
|
-
if (!$.data(this, pluginName)) {
|
323
|
-
$.data(this, pluginName, new MainMenu(this, options, otherOptions));
|
324
|
-
}
|
325
|
-
});
|
326
|
-
};
|
327
318
|
|
328
319
|
export { MainMenu };
|