@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.
- package/README.md +1 -1
- package/dist/cjs/accessibility.js +218 -0
- package/dist/cjs/binder.js +172 -0
- package/dist/cjs/command.js +32 -0
- package/dist/cjs/commandSet.js +167 -0
- package/dist/cjs/controller.js +1207 -0
- package/dist/cjs/documentMapArea.js +168 -0
- package/dist/cjs/domUtils.js +50 -0
- package/dist/cjs/enums.js +52 -0
- package/dist/cjs/event-emitter.js +17 -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 +332 -0
- package/dist/cjs/mem-storage.js +44 -0
- package/dist/cjs/pagesArea.js +641 -0
- package/dist/cjs/parameterValidators.js +167 -0
- package/dist/cjs/parameters.js +921 -0
- package/dist/cjs/parametersArea.js +502 -0
- package/dist/cjs/perspectives.js +138 -0
- package/dist/cjs/print.js +166 -0
- package/dist/cjs/report-viewer/report-viewer-settings.js +138 -0
- package/dist/cjs/reportViewer.js +654 -0
- package/dist/cjs/scroll.js +537 -0
- package/dist/cjs/search.js +634 -0
- package/dist/cjs/sendEmail.js +435 -0
- package/dist/cjs/service-client-sentinel.js +52 -0
- package/dist/cjs/serviceClient.js +405 -0
- package/dist/cjs/sideMenu.js +225 -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/touch.js +86 -0
- package/dist/cjs/uiController.js +142 -0
- package/dist/cjs/uiFreezeCoordinator.js +281 -0
- package/dist/cjs/utils.js +492 -0
- package/dist/es/accessibility.js +214 -0
- package/dist/es/binder.js +168 -0
- package/dist/es/command.js +28 -0
- package/dist/es/commandSet.js +163 -0
- package/dist/es/controller.js +1203 -0
- package/dist/es/documentMapArea.js +164 -0
- package/dist/es/domUtils.js +43 -0
- package/dist/es/enums.js +41 -0
- package/dist/es/event-emitter.js +13 -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 +328 -0
- package/dist/es/mem-storage.js +40 -0
- package/dist/es/pagesArea.js +637 -0
- package/dist/es/parameterValidators.js +163 -0
- package/dist/es/parameters.js +916 -0
- package/dist/es/parametersArea.js +498 -0
- package/dist/es/perspectives.js +134 -0
- package/dist/es/print.js +162 -0
- package/dist/es/report-viewer/report-viewer-settings.js +134 -0
- package/dist/es/reportViewer.js +650 -0
- package/dist/es/scroll.js +533 -0
- package/dist/es/search.js +630 -0
- package/dist/es/sendEmail.js +431 -0
- package/dist/es/service-client-sentinel.js +48 -0
- package/dist/es/serviceClient.js +401 -0
- package/dist/es/sideMenu.js +221 -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/touch.js +82 -0
- package/dist/es/uiController.js +138 -0
- package/dist/es/uiFreezeCoordinator.js +277 -0
- package/dist/es/utils.js +447 -0
- package/dist/font/font-icons.css +4 -4
- package/dist/font/font-icons.min.css +3 -3
- package/dist/js/telerikReportViewer.js +8562 -8606
- package/dist/js/telerikReportViewer.min.js +1 -17
- package/dist/js/telerikReportViewer.stringResources.js +166 -173
- package/dist/styles/telerikReportViewer.css +1 -1
- package/dist/styles/telerikReportViewer.min.css +1 -1
- package/dist/templates/telerikReportViewerTemplate-FA.html +3 -3
- package/dist/templates/telerikReportViewerTemplate.html +3 -3
- package/package.json +13 -7
- /package/dist/font/{ReportingIcons-18.0.24.305.ttf → ReportingIcons-18.1.24.514.ttf} +0 -0
@@ -0,0 +1,641 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var utils = require('./utils.js');
|
6
|
+
var domUtils = require('./domUtils.js');
|
7
|
+
var stringResources = require('./stringResources.js');
|
8
|
+
var touch = require('./touch.js');
|
9
|
+
var scroll = require('./scroll.js');
|
10
|
+
var uiFreezeCoordinator = require('./uiFreezeCoordinator.js');
|
11
|
+
var enums = require('./enums.js');
|
12
|
+
|
13
|
+
var defaultOptions = {};
|
14
|
+
function PagesArea(placeholder, options, otherOptions) {
|
15
|
+
options = $.extend({}, defaultOptions, options, otherOptions);
|
16
|
+
var controller = options.controller;
|
17
|
+
if (!controller)
|
18
|
+
throw "No controller (telerikReportViewer.reportViewerController) has been specified.";
|
19
|
+
var $placeholder = $(placeholder);
|
20
|
+
var $pageContainer = $placeholder.find(".trv-page-container");
|
21
|
+
var pageContainer = $pageContainer[0];
|
22
|
+
var $pageWrapper = $placeholder.find(".trv-page-wrapper");
|
23
|
+
var pageWrapper = $pageWrapper[0];
|
24
|
+
var $errorMessage = $placeholder.find(".trv-error-message");
|
25
|
+
var actions;
|
26
|
+
var pendingElement;
|
27
|
+
var pageScaleMode = controller.getScaleMode();
|
28
|
+
var pageScale = controller.getScale();
|
29
|
+
var minPageScale = 0.1;
|
30
|
+
var maxPageScale = 8;
|
31
|
+
var documentReady = true;
|
32
|
+
var navigateToPageOnDocReady;
|
33
|
+
var navigateToElementOnDocReady;
|
34
|
+
var isNewReportSource;
|
35
|
+
var showErrorTimeoutId;
|
36
|
+
var showPageAreaImage = false;
|
37
|
+
var reportPageIsLoaded = false;
|
38
|
+
var pageAreaImageStyle = '.trv-page-container {background: #ffffff url("{0}") no-repeat center 50px}';
|
39
|
+
var pageAreaImageID = "trv-initial-image-styles";
|
40
|
+
var scroll$1 = utils.extend({}, scroll.Scroll, {});
|
41
|
+
var uiFreezeCoordinator$1 = null;
|
42
|
+
init();
|
43
|
+
if (scroll$1) {
|
44
|
+
scroll$1.init(placeholder, options);
|
45
|
+
}
|
46
|
+
function init() {
|
47
|
+
replaceStringResources($placeholder);
|
48
|
+
}
|
49
|
+
function replaceStringResources($pagesArea) {
|
50
|
+
$pagesArea.attr("aria-label", stringResources.stringResources[$pagesArea.attr("aria-label")]);
|
51
|
+
}
|
52
|
+
$(window).on("resize", function(event, args) {
|
53
|
+
if (shouldAutosizePage()) {
|
54
|
+
updatePageDimensions();
|
55
|
+
}
|
56
|
+
});
|
57
|
+
enableTouch($placeholder);
|
58
|
+
function clearPendingTimeoutIds() {
|
59
|
+
if (showErrorTimeoutId) {
|
60
|
+
window.clearTimeout(showErrorTimeoutId);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
function invalidateCurrentlyLoadedPage() {
|
64
|
+
var page = findPage(navigateToPageOnDocReady);
|
65
|
+
if (page) {
|
66
|
+
pageNo(page, -1);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
function navigateWhenPageAvailable(pageNumber, pageCount) {
|
70
|
+
if (pageNumber && pageNumber <= pageCount) {
|
71
|
+
navigateToPage(pageNumber, navigateToElementOnDocReady);
|
72
|
+
}
|
73
|
+
}
|
74
|
+
function navigateOnLoadComplete(pageNumber, pageCount) {
|
75
|
+
if (pageNumber) {
|
76
|
+
pageNumber = Math.min(pageNumber, pageCount);
|
77
|
+
navigateToPage(pageNumber, navigateToElementOnDocReady);
|
78
|
+
}
|
79
|
+
}
|
80
|
+
function clearPage() {
|
81
|
+
clear(isNewReportSource);
|
82
|
+
isNewReportSource = false;
|
83
|
+
}
|
84
|
+
controller.pageModeChanged(function() {
|
85
|
+
if (controller.getPageMode() === enums.PageModes.CONTINUOUS_SCROLL) {
|
86
|
+
scroll$1.enable();
|
87
|
+
} else {
|
88
|
+
scroll$1.disable();
|
89
|
+
}
|
90
|
+
controller.refreshReport(true);
|
91
|
+
}).reportSourceChanged(function() {
|
92
|
+
isNewReportSource = true;
|
93
|
+
navigateToPageOnDocReady = null;
|
94
|
+
navigateToElementOnDocReady = null;
|
95
|
+
documentReady = false;
|
96
|
+
}).beforeLoadParameters(function(event, initial) {
|
97
|
+
if (initial) {
|
98
|
+
showError(stringResources.stringResources.loadingReport);
|
99
|
+
}
|
100
|
+
}).beforeLoadReport(function() {
|
101
|
+
documentReady = false;
|
102
|
+
if (!navigateToPageOnDocReady) {
|
103
|
+
navigateToPageOnDocReady = 1;
|
104
|
+
}
|
105
|
+
clearPendingTimeoutIds();
|
106
|
+
clear();
|
107
|
+
disablePagesArea(true);
|
108
|
+
showError(stringResources.stringResources.loadingReport);
|
109
|
+
}).beginLoadReport(function(event, args) {
|
110
|
+
documentReady = true;
|
111
|
+
invalidateCurrentlyLoadedPage();
|
112
|
+
}).reportLoadProgress(function(event, args) {
|
113
|
+
navigateWhenPageAvailable(navigateToPageOnDocReady, args.pageCount);
|
114
|
+
showError(utils.stringFormat(stringResources.stringResources.loadingReportPagesInProgress, [args.pageCount]));
|
115
|
+
}).reportLoadComplete(function(event, args) {
|
116
|
+
if (0 === args.pageCount) {
|
117
|
+
clearPage();
|
118
|
+
showError(stringResources.stringResources.noPageToDisplay);
|
119
|
+
} else {
|
120
|
+
navigateOnLoadComplete(navigateToPageOnDocReady, args.pageCount);
|
121
|
+
showError(utils.stringFormat(stringResources.stringResources.loadedReportPagesComplete, [args.pageCount]));
|
122
|
+
showErrorTimeoutId = window.setTimeout(showError, 2e3);
|
123
|
+
enableInteractivity();
|
124
|
+
}
|
125
|
+
if (args.containsFrozenContent && !uiFreezeCoordinator$1) {
|
126
|
+
uiFreezeCoordinator$1 = utils.extend({}, uiFreezeCoordinator.UIFreezeCoordinator, {});
|
127
|
+
if (controller.getViewMode() === enums.ViewModes.INTERACTIVE) {
|
128
|
+
uiFreezeCoordinator$1.init($placeholder);
|
129
|
+
}
|
130
|
+
}
|
131
|
+
}).navigateToPage(function(event, pageNumber, targetElement) {
|
132
|
+
navigateToPage(pageNumber, targetElement);
|
133
|
+
}).pageReady(function(event, page) {
|
134
|
+
if (controller.getPageMode() === enums.PageModes.SINGLE_PAGE) {
|
135
|
+
if (scroll$1.isEnabled()) {
|
136
|
+
scroll$1.disable();
|
137
|
+
}
|
138
|
+
setPageContent(page);
|
139
|
+
} else {
|
140
|
+
scroll$1.renderPage(page);
|
141
|
+
}
|
142
|
+
if (!reportPageIsLoaded) {
|
143
|
+
reportPageIsLoaded = true;
|
144
|
+
}
|
145
|
+
if (showPageAreaImage) {
|
146
|
+
clearPageAreaImage();
|
147
|
+
}
|
148
|
+
if (controller.getViewMode() === enums.ViewModes.INTERACTIVE && uiFreezeCoordinator$1) {
|
149
|
+
uiFreezeCoordinator$1.init($placeholder);
|
150
|
+
}
|
151
|
+
disablePagesArea(false);
|
152
|
+
}).error(function(event, error) {
|
153
|
+
disablePagesArea(false);
|
154
|
+
clearPage();
|
155
|
+
showError(error);
|
156
|
+
}).showNotification(function(event, args) {
|
157
|
+
showError(stringResources.stringResources[args.stringResources]);
|
158
|
+
}).hideNotification(function(event, args) {
|
159
|
+
showError();
|
160
|
+
}).scaleChanged(function(event, scale) {
|
161
|
+
setPageScale({
|
162
|
+
scale,
|
163
|
+
scaleMode: controller.getScaleMode()
|
164
|
+
});
|
165
|
+
}).scaleModeChanged(function(event, scaleMode) {
|
166
|
+
setPageScale({
|
167
|
+
scale: controller.getScale(),
|
168
|
+
scaleMode
|
169
|
+
});
|
170
|
+
}).serverActionStarted(function() {
|
171
|
+
disablePagesArea(true);
|
172
|
+
showError(stringResources.stringResources.loadingReport);
|
173
|
+
}).scrollPageReady(function(event, args) {
|
174
|
+
setScrollablePage(args);
|
175
|
+
}).missingOrInvalidParameters(function(event, args) {
|
176
|
+
if (options.initialPageAreaImageUrl && !reportPageIsLoaded) {
|
177
|
+
clearPage();
|
178
|
+
setPageAreaImage();
|
179
|
+
}
|
180
|
+
}).renderingStopped(function() {
|
181
|
+
clear(true);
|
182
|
+
showError(stringResources.stringResources.renderingCanceled);
|
183
|
+
});
|
184
|
+
controller.setDocumentMapVisible(function() {
|
185
|
+
if (shouldAutosizePage()) {
|
186
|
+
setTimeout(function() {
|
187
|
+
updatePageDimensions();
|
188
|
+
});
|
189
|
+
}
|
190
|
+
}).setParametersAreaVisible(function() {
|
191
|
+
if (shouldAutosizePage()) {
|
192
|
+
setTimeout(function() {
|
193
|
+
updatePageDimensions();
|
194
|
+
});
|
195
|
+
}
|
196
|
+
});
|
197
|
+
function enableTouch(dom) {
|
198
|
+
var allowSwipeLeft;
|
199
|
+
var allowSwipeRight;
|
200
|
+
touch.TouchBehavior(
|
201
|
+
dom,
|
202
|
+
{
|
203
|
+
swipe: function(e) {
|
204
|
+
var pageNumber = controller.getCurrentPageNumber();
|
205
|
+
if (allowSwipeLeft && e.direction === "left") {
|
206
|
+
if (pageNumber < controller.getPageCount()) {
|
207
|
+
controller.navigateToPage(pageNumber + 1);
|
208
|
+
}
|
209
|
+
} else if (allowSwipeRight && e.direction === "right") {
|
210
|
+
if (pageNumber > 1) {
|
211
|
+
controller.navigateToPage(pageNumber - 1);
|
212
|
+
}
|
213
|
+
}
|
214
|
+
},
|
215
|
+
pinch: function(e) {
|
216
|
+
var page = getCurrentPage();
|
217
|
+
var scale = $(page).data("pageScale") || pageScale;
|
218
|
+
var f = e.distance / e.lastDistance;
|
219
|
+
setPageScale({
|
220
|
+
scale: scale * f,
|
221
|
+
scaleMode: enums.ScaleModes.SPECIFIC
|
222
|
+
});
|
223
|
+
},
|
224
|
+
doubletap: function(e) {
|
225
|
+
options.commands.toggleZoomMode.exec();
|
226
|
+
},
|
227
|
+
touchstart: function(e) {
|
228
|
+
var el = pageWrapper;
|
229
|
+
allowSwipeRight = 0 === el.scrollLeft;
|
230
|
+
allowSwipeLeft = el.scrollWidth - el.offsetWidth === el.scrollLeft;
|
231
|
+
}
|
232
|
+
}
|
233
|
+
);
|
234
|
+
}
|
235
|
+
function shouldAutosizePage() {
|
236
|
+
return -1 !== [enums.ScaleModes.FIT_PAGE, enums.ScaleModes.FIT_PAGE_WIDTH].indexOf(pageScaleMode);
|
237
|
+
}
|
238
|
+
function updatePageDimensions() {
|
239
|
+
for (var i = 0, children = $pageContainer.find(".trv-report-page"), len = children.length; i < len; i++) {
|
240
|
+
var pageNumber = parseInt($(children[i]).attr("data-page"));
|
241
|
+
setPageDimensions(children[i], pageScaleMode, pageScale, pageNumber);
|
242
|
+
}
|
243
|
+
controller.updatePageDimensionsReady();
|
244
|
+
}
|
245
|
+
function setPageScale({ scale, scaleMode }) {
|
246
|
+
pageScale = scale || pageScale;
|
247
|
+
pageScaleMode = scaleMode || pageScaleMode;
|
248
|
+
pageScale = Math.max(minPageScale, Math.min(maxPageScale, pageScale));
|
249
|
+
updatePageDimensions();
|
250
|
+
}
|
251
|
+
function clear(clearPageWrapper) {
|
252
|
+
disableInteractivity();
|
253
|
+
pendingElement = void 0;
|
254
|
+
if (clearPageWrapper) {
|
255
|
+
$pageWrapper.empty();
|
256
|
+
}
|
257
|
+
showError();
|
258
|
+
}
|
259
|
+
function getCurrentPage() {
|
260
|
+
return findPage(controller.getCurrentPageNumber());
|
261
|
+
}
|
262
|
+
function findPage(pageNumber) {
|
263
|
+
var result;
|
264
|
+
var allPages = $pageContainer.find(".trv-report-page");
|
265
|
+
if (controller.getPageMode() === enums.PageModes.SINGLE_PAGE) {
|
266
|
+
utils.each(allPages, function(index, page) {
|
267
|
+
if (pageNo(page) === pageNumber) {
|
268
|
+
result = page;
|
269
|
+
}
|
270
|
+
return !result;
|
271
|
+
});
|
272
|
+
} else {
|
273
|
+
$.each(allPages, function(index, page) {
|
274
|
+
var dataPageNumber = parseInt($(page).attr("data-page"));
|
275
|
+
if (dataPageNumber === pageNumber) {
|
276
|
+
result = page;
|
277
|
+
return false;
|
278
|
+
}
|
279
|
+
});
|
280
|
+
}
|
281
|
+
return result;
|
282
|
+
}
|
283
|
+
function navigateToPage(pageNumber, targetElement) {
|
284
|
+
if (documentReady) {
|
285
|
+
navigateToPageCore(pageNumber, targetElement);
|
286
|
+
} else {
|
287
|
+
navigateToPageOnDocumentReady(pageNumber, targetElement);
|
288
|
+
}
|
289
|
+
}
|
290
|
+
function navigateToPageOnDocumentReady(pageNumber, targetElement) {
|
291
|
+
navigateToPageOnDocReady = pageNumber;
|
292
|
+
navigateToElementOnDocReady = targetElement;
|
293
|
+
}
|
294
|
+
function navigateToPageCore(pageNumber, targetElement) {
|
295
|
+
var page = findPage(pageNumber);
|
296
|
+
if (page) {
|
297
|
+
if (targetElement) {
|
298
|
+
navigateToElement(targetElement, pageNumber);
|
299
|
+
}
|
300
|
+
if (scroll$1.isEnabled() && !targetElement) {
|
301
|
+
scroll$1.navigateToElement(page.offsetTop, pageNumber);
|
302
|
+
}
|
303
|
+
} else {
|
304
|
+
pendingElement = targetElement;
|
305
|
+
beginLoadPage(pageNumber);
|
306
|
+
}
|
307
|
+
}
|
308
|
+
function navigateToElement(targetElement, pageNumber) {
|
309
|
+
if (targetElement) {
|
310
|
+
var el = $pageContainer.find("[data-" + targetElement.type + "-id=" + targetElement.id + "]")[0];
|
311
|
+
if (el) {
|
312
|
+
if (options.enableAccessibility) {
|
313
|
+
var $nextFocusable = findNextFocusableElement($(el));
|
314
|
+
if ($nextFocusable) {
|
315
|
+
$nextFocusable.focus();
|
316
|
+
}
|
317
|
+
}
|
318
|
+
var container = $pageContainer[0];
|
319
|
+
var offsetTop = 0;
|
320
|
+
var offsetLeft = 0;
|
321
|
+
while (el && el !== container) {
|
322
|
+
if ($(el).is(".trv-page-wrapper")) {
|
323
|
+
var scale = $(el).data("pageScale");
|
324
|
+
if (typeof scale === "number") {
|
325
|
+
offsetTop *= scale;
|
326
|
+
offsetLeft *= scale;
|
327
|
+
}
|
328
|
+
}
|
329
|
+
offsetTop += el.offsetTop;
|
330
|
+
offsetLeft += el.offsetLeft;
|
331
|
+
el = el.offsetParent;
|
332
|
+
}
|
333
|
+
if (scroll$1.isEnabled() && pageNumber) {
|
334
|
+
scroll$1.navigateToElement(offsetTop, pageNumber);
|
335
|
+
} else {
|
336
|
+
container.scrollTop = offsetTop;
|
337
|
+
container.scrollLeft = offsetLeft;
|
338
|
+
}
|
339
|
+
} else {
|
340
|
+
if (scroll$1.isEnabled() && pageNumber) {
|
341
|
+
scroll$1.navigateToElement($placeholder.find('[data-page="' + pageNumber + '"]')[0].offsetTop, pageNumber);
|
342
|
+
}
|
343
|
+
}
|
344
|
+
}
|
345
|
+
}
|
346
|
+
function findNextFocusableElement(element) {
|
347
|
+
if (!element || element.length === 0) {
|
348
|
+
return null;
|
349
|
+
}
|
350
|
+
var num = utils.tryParseInt(element.attr("tabindex"));
|
351
|
+
if (!isNaN(num) && num > -1) {
|
352
|
+
return element;
|
353
|
+
}
|
354
|
+
return findNextFocusableElement(element.next());
|
355
|
+
}
|
356
|
+
function disablePagesArea(disable) {
|
357
|
+
(disable ? $.fn.addClass : $.fn.removeClass).call($placeholder, "trv-loading");
|
358
|
+
}
|
359
|
+
function showError(error) {
|
360
|
+
$errorMessage.text(error);
|
361
|
+
(error ? $.fn.addClass : $.fn.removeClass).call($placeholder, "trv-error");
|
362
|
+
}
|
363
|
+
function pageNo(page, no) {
|
364
|
+
var $page = page.$ ? page : $(page);
|
365
|
+
var dataKey = "pageNumber";
|
366
|
+
if (no === void 0) {
|
367
|
+
return $page.data(dataKey);
|
368
|
+
}
|
369
|
+
$page.data(dataKey, no);
|
370
|
+
return page;
|
371
|
+
}
|
372
|
+
function beginLoadPage(pageNumber) {
|
373
|
+
disablePagesArea(true);
|
374
|
+
window.setTimeout(controller.getReportPage.bind(controller, pageNumber), 1);
|
375
|
+
navigateToPageOnDocReady = null;
|
376
|
+
}
|
377
|
+
function setPageDimensions(page, scaleMode, scale, pageNumber) {
|
378
|
+
var $target = $(page);
|
379
|
+
var $page = pageNumber ? $target : $target.find("div.trv-report-page");
|
380
|
+
var $pageContent = $page.find("div.sheet");
|
381
|
+
var $pageSkeletonContent = $page.find("div.trv-skeleton-wrapper");
|
382
|
+
var pageContent = $pageContent[0] || $pageSkeletonContent[0];
|
383
|
+
var pageSkeletonContent = $pageSkeletonContent[0];
|
384
|
+
if (!pageContent) {
|
385
|
+
return;
|
386
|
+
}
|
387
|
+
var pageWidth;
|
388
|
+
var pageHeight;
|
389
|
+
var box = $target.data("box");
|
390
|
+
if (!box) {
|
391
|
+
var margins = domUtils.getMargins($target);
|
392
|
+
var borders = domUtils.getBorderWidth($page);
|
393
|
+
var padding = domUtils.getPadding($page);
|
394
|
+
box = {
|
395
|
+
padLeft: margins.left + borders.left + padding.left,
|
396
|
+
padRight: margins.right + borders.right + padding.right,
|
397
|
+
padTop: margins.top + borders.top + padding.top,
|
398
|
+
padBottom: margins.bottom + borders.bottom + padding.bottom
|
399
|
+
};
|
400
|
+
$target.data("box", box);
|
401
|
+
}
|
402
|
+
if ($target.data("pageWidth") === void 0) {
|
403
|
+
pageWidth = pageContent.offsetWidth;
|
404
|
+
pageHeight = pageContent.offsetHeight;
|
405
|
+
$target.data("pageWidth", pageWidth);
|
406
|
+
$target.data("pageHeight", pageHeight);
|
407
|
+
} else {
|
408
|
+
pageWidth = $target.data("pageWidth");
|
409
|
+
pageHeight = $target.data("pageHeight");
|
410
|
+
}
|
411
|
+
var scrollBarV = pageHeight > pageWidth && scaleMode === enums.ScaleModes.FIT_PAGE_WIDTH ? 20 : 0;
|
412
|
+
var scaleW = (pageContainer.clientWidth - scrollBarV - box.padLeft - box.padRight) / pageWidth;
|
413
|
+
var scaleH = (pageContainer.clientHeight - 1 - box.padTop - box.padBottom) / pageHeight;
|
414
|
+
if (scaleMode === enums.ScaleModes.FIT_PAGE_WIDTH) {
|
415
|
+
scale = scaleW;
|
416
|
+
} else if (!scale || scaleMode === enums.ScaleModes.FIT_PAGE) {
|
417
|
+
scale = Math.min(scaleW, scaleH);
|
418
|
+
}
|
419
|
+
if (uiFreezeCoordinator$1) {
|
420
|
+
uiFreezeCoordinator$1.setScaleFactor(scale);
|
421
|
+
}
|
422
|
+
$target.data("pageScale", scale);
|
423
|
+
$page.data("pageScale", scale);
|
424
|
+
if (!pageSkeletonContent) {
|
425
|
+
domUtils.scale($pageContent, scale, scale);
|
426
|
+
}
|
427
|
+
$page.css({
|
428
|
+
"height": scale * pageHeight,
|
429
|
+
"width": scale * pageWidth
|
430
|
+
});
|
431
|
+
}
|
432
|
+
function enableInteractivity() {
|
433
|
+
$pageContainer.on("click", "[data-reporting-action]", onInteractiveItemClick);
|
434
|
+
$pageContainer.on("mouseenter", "[data-reporting-action]", onInteractiveItemEnter);
|
435
|
+
$pageContainer.on("mouseleave", "[data-reporting-action]", onInteractiveItemLeave);
|
436
|
+
$pageContainer.on("mouseenter", "[data-tooltip-title],[data-tooltip-text]", onToolTipItemEnter);
|
437
|
+
$pageContainer.on("mouseleave", "[data-tooltip-title],[data-tooltip-text]", onToolTipItemLeave);
|
438
|
+
}
|
439
|
+
function disableInteractivity() {
|
440
|
+
$pageContainer.off("click", "[data-reporting-action]", onInteractiveItemClick);
|
441
|
+
$pageContainer.off("mouseenter", "[data-reporting-action]", onInteractiveItemEnter);
|
442
|
+
$pageContainer.off("mouseleave", "[data-reporting-action]", onInteractiveItemLeave);
|
443
|
+
$pageContainer.off("mouseenter", "[data-tooltip-title],[data-tooltip-text]", onToolTipItemEnter);
|
444
|
+
$pageContainer.off("mouseleave", "[data-tooltip-title],[data-tooltip-text]", onToolTipItemLeave);
|
445
|
+
}
|
446
|
+
function onInteractiveItemClick(event) {
|
447
|
+
var $eventTarget = $(this);
|
448
|
+
var actionId = $eventTarget.attr("data-reporting-action");
|
449
|
+
var action = getAction(actionId);
|
450
|
+
if (action) {
|
451
|
+
navigateToPageOnDocReady = getNavigateToPageOnDocReady(event, action.Type);
|
452
|
+
controller.executeReportAction({
|
453
|
+
element: event.currentTarget,
|
454
|
+
action,
|
455
|
+
cancel: false
|
456
|
+
});
|
457
|
+
}
|
458
|
+
event.stopPropagation();
|
459
|
+
}
|
460
|
+
function getNavigateToPageOnDocReady(event, actionType) {
|
461
|
+
if (scroll$1.isEnabled() && (actionType === "sorting" || actionType === "toggleVisibility")) {
|
462
|
+
return $(event.target).closest(".trv-report-page").attr("data-page") || controller.getCurrentPageNumber();
|
463
|
+
}
|
464
|
+
return controller.getCurrentPageNumber();
|
465
|
+
}
|
466
|
+
function onInteractiveItemEnter(args) {
|
467
|
+
var $t = $(this);
|
468
|
+
var actionId = $t.attr("data-reporting-action");
|
469
|
+
var a = getAction(actionId);
|
470
|
+
if (a !== null && args.currentTarget === this) {
|
471
|
+
controller.reportActionEnter({
|
472
|
+
element: args.currentTarget,
|
473
|
+
action: a
|
474
|
+
});
|
475
|
+
}
|
476
|
+
}
|
477
|
+
function onInteractiveItemLeave(args) {
|
478
|
+
var $t = $(this);
|
479
|
+
var actionId = $t.attr("data-reporting-action");
|
480
|
+
var a = getAction(actionId);
|
481
|
+
if (a !== null && args.currentTarget === this) {
|
482
|
+
controller.reportActionLeave({
|
483
|
+
element: args.currentTarget,
|
484
|
+
action: a
|
485
|
+
});
|
486
|
+
}
|
487
|
+
}
|
488
|
+
function getAction(actionId) {
|
489
|
+
if (actions) {
|
490
|
+
var action;
|
491
|
+
utils.each(actions, function() {
|
492
|
+
if (this.Id === actionId) {
|
493
|
+
action = this;
|
494
|
+
}
|
495
|
+
return action === void 0;
|
496
|
+
});
|
497
|
+
return action;
|
498
|
+
}
|
499
|
+
return null;
|
500
|
+
}
|
501
|
+
function onToolTipItemEnter(args) {
|
502
|
+
var $t = $(this);
|
503
|
+
var title = $t.attr("data-tooltip-title");
|
504
|
+
var text = $t.attr("data-tooltip-text");
|
505
|
+
if (!title && !text) {
|
506
|
+
return;
|
507
|
+
}
|
508
|
+
var toolTipArgs = {
|
509
|
+
element: args.currentTarget,
|
510
|
+
toolTip: {
|
511
|
+
title: title || "",
|
512
|
+
text: text || ""
|
513
|
+
},
|
514
|
+
cancel: false
|
515
|
+
};
|
516
|
+
controller.reportToolTipOpening(toolTipArgs);
|
517
|
+
if (toolTipArgs.cancel) {
|
518
|
+
return;
|
519
|
+
}
|
520
|
+
var content = applyToolTipTemplate(toolTipArgs);
|
521
|
+
var viewportElement = args.currentTarget.viewportElement;
|
522
|
+
var ktt = getToolTip($t, content);
|
523
|
+
ktt.show($t);
|
524
|
+
if (viewportElement && viewportElement.nodeName === "svg") {
|
525
|
+
positionToolTip(ktt, args);
|
526
|
+
}
|
527
|
+
}
|
528
|
+
function applyToolTipTemplate(toolTipArgs) {
|
529
|
+
var toolTipTemplate = options.templates["trv-pages-area-kendo-tooltip"];
|
530
|
+
var $container = $(toolTipTemplate);
|
531
|
+
var $titleSpan = $container.find(".trv-pages-area-kendo-tooltip-title");
|
532
|
+
var $textSpan = $container.find(".trv-pages-area-kendo-tooltip-text");
|
533
|
+
$titleSpan.html(replaceNewLineSymbols(toolTipArgs.toolTip.title));
|
534
|
+
$textSpan.html(replaceNewLineSymbols(toolTipArgs.toolTip.text));
|
535
|
+
return $container.clone().wrap("<p>").parent().html();
|
536
|
+
}
|
537
|
+
function replaceNewLineSymbols(tooltipText) {
|
538
|
+
tooltipText = utils.escapeHtml(tooltipText);
|
539
|
+
tooltipText = tooltipText.replaceAll("\r\n", "<br>");
|
540
|
+
tooltipText = tooltipText.replaceAll("\n", "<br>");
|
541
|
+
return tooltipText;
|
542
|
+
}
|
543
|
+
function positionToolTip(toolTip, e) {
|
544
|
+
var x = e.pageX;
|
545
|
+
var y = e.pageY;
|
546
|
+
var container = toolTip.popup.element.closest("[role=region]");
|
547
|
+
container.css({
|
548
|
+
left: x + 10,
|
549
|
+
top: y + 5
|
550
|
+
});
|
551
|
+
}
|
552
|
+
function getToolTip(target, toolTipContent) {
|
553
|
+
var ktt = target.data("kendoTooltip");
|
554
|
+
if (!ktt) {
|
555
|
+
try {
|
556
|
+
ktt = target.kendoTooltip({
|
557
|
+
content: toolTipContent,
|
558
|
+
autohide: true,
|
559
|
+
callout: false
|
560
|
+
}).data("kendoTooltip");
|
561
|
+
} catch (e) {
|
562
|
+
console.error("Instantiation of Kendo Tooltip threw an exception", e);
|
563
|
+
throw e;
|
564
|
+
}
|
565
|
+
}
|
566
|
+
return ktt;
|
567
|
+
}
|
568
|
+
function onToolTipItemLeave(args) {
|
569
|
+
var $t = $(this);
|
570
|
+
var toolTip = $t.data("kendoTooltip");
|
571
|
+
if (toolTip) {
|
572
|
+
toolTip.hide();
|
573
|
+
}
|
574
|
+
}
|
575
|
+
function updatePageStyle(page) {
|
576
|
+
var styleId = "trv-" + controller.clientId() + "-styles";
|
577
|
+
$("#" + styleId).remove();
|
578
|
+
var pageStyles = $("<style id=" + styleId + "></style>");
|
579
|
+
pageStyles.append(page.pageStyles);
|
580
|
+
pageStyles.appendTo("head");
|
581
|
+
}
|
582
|
+
function setPageContent(page) {
|
583
|
+
actions = JSON.parse(page.pageActions);
|
584
|
+
updatePageStyle(page);
|
585
|
+
var pageNumber = page.pageNumber;
|
586
|
+
var wrapper = $($.parseHTML(page.pageContent));
|
587
|
+
var $pageContent = wrapper.find("div.sheet");
|
588
|
+
var $page = $('<div class="trv-report-page" data-page="' + pageNumber + '"></div>');
|
589
|
+
$pageContent.css("margin", 0);
|
590
|
+
$page.append($pageContent).append($('<div class="trv-page-overlay"></div>'));
|
591
|
+
var $target = $pageWrapper.empty().removeData().data("pageNumber", pageNumber).append($page);
|
592
|
+
controller.setCurrentPageNumber(pageNumber);
|
593
|
+
if (controller.getViewMode() === enums.ViewModes.INTERACTIVE) {
|
594
|
+
$placeholder.removeClass("printpreview");
|
595
|
+
$placeholder.addClass("interactive");
|
596
|
+
} else {
|
597
|
+
$placeholder.removeClass("interactive");
|
598
|
+
$placeholder.addClass("printpreview");
|
599
|
+
}
|
600
|
+
setPageDimensions($target, pageScaleMode, pageScale);
|
601
|
+
$pageContainer.scrollTop(0);
|
602
|
+
$pageContainer.scrollLeft(0);
|
603
|
+
navigateToElement(pendingElement);
|
604
|
+
}
|
605
|
+
function setScrollablePage(args) {
|
606
|
+
var pageActions = JSON.parse(args.page.pageActions);
|
607
|
+
if (!actions) {
|
608
|
+
actions = pageActions;
|
609
|
+
} else {
|
610
|
+
actions = actions.concat(pageActions);
|
611
|
+
}
|
612
|
+
if (controller.getViewMode() === enums.ViewModes.INTERACTIVE) {
|
613
|
+
$placeholder.removeClass("printpreview");
|
614
|
+
$placeholder.addClass("interactive");
|
615
|
+
} else {
|
616
|
+
$placeholder.removeClass("interactive");
|
617
|
+
$placeholder.addClass("printpreview");
|
618
|
+
}
|
619
|
+
setPageDimensions(args.target, pageScaleMode, pageScale, args.page.pageNumber);
|
620
|
+
}
|
621
|
+
function setPageAreaImage() {
|
622
|
+
var pageStyles = $("<style id=" + pageAreaImageID + "></style>");
|
623
|
+
clearPageAreaImage();
|
624
|
+
pageStyles.append(utils.stringFormat(pageAreaImageStyle, [options.initialPageAreaImageUrl]));
|
625
|
+
pageStyles.appendTo("head");
|
626
|
+
showPageAreaImage = true;
|
627
|
+
}
|
628
|
+
function clearPageAreaImage() {
|
629
|
+
$("#" + pageAreaImageID).remove();
|
630
|
+
}
|
631
|
+
}
|
632
|
+
var pluginName = "telerik_ReportViewer_PagesArea";
|
633
|
+
$.fn[pluginName] = function(options, otherOptions) {
|
634
|
+
return utils.each(this, function() {
|
635
|
+
if (!$.data(this, pluginName)) {
|
636
|
+
$.data(this, pluginName, new PagesArea(this, options, otherOptions));
|
637
|
+
}
|
638
|
+
});
|
639
|
+
};
|
640
|
+
|
641
|
+
exports.PagesArea = PagesArea;
|