@progress/telerik-jquery-report-viewer 21.24.130 → 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 +8574 -8249
  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.130.ttf → ReportingIcons-18.1.24.514.ttf} +0 -0
@@ -0,0 +1,634 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var utils = require('./utils.js');
6
+ var stringResources = require('./stringResources.js');
7
+ var binder = require('./binder.js');
8
+ var enums = require('./enums.js');
9
+
10
+ var defaultOptions = {};
11
+ function Search(placeholder, options, viewerOptions) {
12
+ options = $.extend({}, defaultOptions, options);
13
+ var controller = options.controller;
14
+ var initialized = false;
15
+ var dialogVisible = false;
16
+ var $placeholder;
17
+ var $inputBox;
18
+ var $searchOptionsPlaceholder;
19
+ var searchOptionsMenu;
20
+ var $stopSearchPlaceholder;
21
+ var stopSearchMenu;
22
+ var $navigationPlaceholder;
23
+ var navigationMenu;
24
+ var $resultsLabel;
25
+ var $resultsPlaceholder;
26
+ var kendoComboBox;
27
+ var kendoSearchDialog;
28
+ var stopSearchCommand;
29
+ var optionsCommandSet;
30
+ var navigationCommandSet;
31
+ var searchResults;
32
+ var mruList = [];
33
+ var inputComboRebinding;
34
+ var searchMetadataRequested;
35
+ var searchMetadataLoaded;
36
+ var pendingHighlightItem;
37
+ var windowLocation;
38
+ var reportViewerWrapper = $("[data-selector='" + viewerOptions.viewerSelector + "']").find(".trv-report-viewer");
39
+ var lastSearch = "";
40
+ var highlightManager = {
41
+ shadedClassName: "trv-search-dialog-shaded-result",
42
+ //the results that are found, but not selected (highlighted)
43
+ highlightedClassName: "trv-search-dialog-highlighted-result",
44
+ //the result that is currently selected (highlighted)
45
+ current: null,
46
+ elements: []
47
+ };
48
+ if (!controller) {
49
+ throw "No controller (telerikReporting.ReportViewerController) has been specified.";
50
+ }
51
+ controller.pageReady(onPageReady).scrollPageReady(onPageReady).beginLoadReport(closeAndClear).viewModeChanged(closeAndClear);
52
+ controller.setSendEmailDialogVisible(function(event, args) {
53
+ if (args.visible && dialogVisible) {
54
+ toggle(!dialogVisible);
55
+ }
56
+ }).getSearchDialogState(function(event, args) {
57
+ args.visible = dialogVisible;
58
+ }).setSearchDialogVisible(function(event, args) {
59
+ toggleSearchDialog(args.visible);
60
+ });
61
+ function closeAndClear() {
62
+ if (searchMetadataRequested) {
63
+ return;
64
+ }
65
+ toggle(false);
66
+ searchMetadataLoaded = false;
67
+ }
68
+ function toggleSearchDialog(show) {
69
+ dialogVisible = show;
70
+ if (show) {
71
+ var searchMetadataOnDemand = viewerOptions.searchMetadataOnDemand;
72
+ if (searchMetadataOnDemand && !searchMetadataLoaded) {
73
+ searchMetadataRequested = true;
74
+ controller.reportLoadComplete(function() {
75
+ if (searchMetadataRequested) {
76
+ toggle(true);
77
+ searchMetadataRequested = false;
78
+ }
79
+ });
80
+ controller.refreshReport(true);
81
+ return;
82
+ }
83
+ }
84
+ toggle(show);
85
+ }
86
+ function toggle(show) {
87
+ dialogVisible = show;
88
+ if (show) {
89
+ searchMetadataLoaded = true;
90
+ ensureInitialized();
91
+ kendoSearchDialog.open();
92
+ kendoComboBox.value("");
93
+ updateResultsUI(null);
94
+ toggleErrorLabel(false, null);
95
+ } else {
96
+ clearColoredItems();
97
+ if (kendoSearchDialog && kendoSearchDialog.options.visible) {
98
+ kendoSearchDialog.close();
99
+ }
100
+ }
101
+ }
102
+ function ensureInitialized() {
103
+ if (!initialized) {
104
+ $placeholder = $(placeholder);
105
+ $inputBox = $placeholder.find(".trv-search-dialog-input-box");
106
+ $resultsLabel = $placeholder.find(".trv-search-dialog-results-label");
107
+ $resultsPlaceholder = $placeholder.find(".trv-search-dialog-results-area");
108
+ initResultsArea();
109
+ replaceStringResources($placeholder);
110
+ try {
111
+ $searchOptionsPlaceholder = $placeholder.find(".trv-search-dialog-search-options").kendoMenu();
112
+ $stopSearchPlaceholder = $placeholder.find(".trv-search-dialog-stopsearch-placeholder").kendoMenu();
113
+ $navigationPlaceholder = $placeholder.find(".trv-search-dialog-navigational-buttons").kendoMenu();
114
+ } catch (e) {
115
+ console.error("Instantiation of Kendo Menu for Search Dialog threw an exception", e);
116
+ throw e;
117
+ }
118
+ searchOptionsMenu = $searchOptionsPlaceholder.data("kendoMenu");
119
+ stopSearchMenu = $stopSearchPlaceholder.data("kendoMenu");
120
+ navigationMenu = $navigationPlaceholder.data("kendoMenu");
121
+ searchOptionsMenu.element.on("keydown", onKeyDown);
122
+ stopSearchMenu.element.on("keydown", onKeyDown);
123
+ navigationMenu.element.on("keydown", onKeyDown);
124
+ overrideDefaultMenuStyling(".trv-search-dialog-search-options");
125
+ try {
126
+ kendoComboBox = $inputBox.kendoComboBox({
127
+ dataTextField: "value",
128
+ dataValueField: "value",
129
+ dataSource: mruList,
130
+ contentElement: "",
131
+ change: kendoComboBoxSelect,
132
+ ignoreCase: false,
133
+ filtering: onInputFiltering,
134
+ //the actual search-when-typing performs on this event.
135
+ filter: "startswith",
136
+ delay: 1e3,
137
+ open: function(e) {
138
+ if (inputComboRebinding) {
139
+ e.preventDefault();
140
+ }
141
+ },
142
+ select: processComboBoxEvent
143
+ }).data("kendoComboBox");
144
+ } catch (e) {
145
+ console.error("Instantiation of Kendo ComboBox as search input threw an exception", e);
146
+ throw e;
147
+ }
148
+ try {
149
+ kendoSearchDialog = reportViewerWrapper.find(".trv-search-window").kendoWindow({
150
+ title: stringResources.stringResources.searchDialogTitle,
151
+ height: 390,
152
+ width: 310,
153
+ minWidth: 310,
154
+ minHeight: 390,
155
+ maxHeight: 700,
156
+ scrollable: false,
157
+ close: function() {
158
+ storeDialogPosition();
159
+ lastSearch = "";
160
+ },
161
+ open: function() {
162
+ adjustDialogPosition();
163
+ },
164
+ deactivate: function() {
165
+ controller.setSearchDialogVisible({
166
+ visible: false
167
+ });
168
+ },
169
+ activate: function() {
170
+ kendoComboBox.input.focus();
171
+ }
172
+ }).data("kendoWindow");
173
+ } catch (e) {
174
+ console.error("Instantiation of Kendo Window for Search dialog threw an exception", e);
175
+ throw e;
176
+ }
177
+ kendoSearchDialog.wrapper.addClass("trv-search");
178
+ initCommands();
179
+ initialized = true;
180
+ }
181
+ }
182
+ function overrideDefaultMenuStyling(kendoMenuSelector) {
183
+ var menuItems = $(kendoMenuSelector).find(".k-menu-item");
184
+ for (var i = 0; i < menuItems.length; i++) {
185
+ $(menuItems[i]).removeClass("k-item");
186
+ }
187
+ }
188
+ function onKeyDown(event) {
189
+ var item = $(event.target).find(".k-focus");
190
+ if (event.keyCode === 13 && item && item.length > 0) {
191
+ var anchor = item.children("a");
192
+ if (anchor.length > 0) {
193
+ anchor.click();
194
+ }
195
+ }
196
+ }
197
+ $(window).resize(function() {
198
+ if (kendoSearchDialog && kendoSearchDialog.options.visible) {
199
+ storeDialogPosition();
200
+ adjustDialogPosition();
201
+ }
202
+ });
203
+ function storeDialogPosition() {
204
+ var kendoWindow = kendoSearchDialog.element.parent(".k-window");
205
+ windowLocation = kendoWindow.offset();
206
+ }
207
+ function adjustDialogPosition() {
208
+ var windowWidth = $(window).innerWidth();
209
+ var windowHeight = $(window).innerHeight();
210
+ var kendoWindow = kendoSearchDialog.wrapper;
211
+ var width = kendoWindow.outerWidth(true);
212
+ var height = kendoWindow.outerHeight(true);
213
+ var padding = 10;
214
+ if (!windowLocation) {
215
+ var reportViewerCoords = reportViewerWrapper[0].getBoundingClientRect();
216
+ kendoWindow.css({
217
+ top: reportViewerCoords.top + padding,
218
+ left: reportViewerCoords.right - width - padding
219
+ });
220
+ kendoSearchDialog.setOptions({
221
+ position: {
222
+ top: reportViewerCoords.top + padding,
223
+ left: reportViewerCoords.right - width - padding
224
+ }
225
+ });
226
+ } else {
227
+ var left = windowLocation.left;
228
+ var top = windowLocation.top;
229
+ var right = left + width;
230
+ var bottom = top + height;
231
+ if (right > windowWidth - padding) {
232
+ left = Math.max(padding, windowWidth - width - padding);
233
+ kendoWindow.css({ left });
234
+ kendoSearchDialog.setOptions({
235
+ position: {
236
+ left
237
+ }
238
+ });
239
+ }
240
+ if (bottom > windowHeight - padding) {
241
+ top = Math.max(padding, windowHeight - height - padding);
242
+ kendoWindow.css({ top });
243
+ kendoSearchDialog.setOptions({
244
+ position: {
245
+ top
246
+ }
247
+ });
248
+ }
249
+ }
250
+ }
251
+ function processComboBoxEvent(e) {
252
+ if (!(window.event || window.event.type)) {
253
+ return;
254
+ }
255
+ var evt = window.event;
256
+ if (evt.type === "keydown") {
257
+ e.preventDefault();
258
+ if (evt.keyCode === 40) {
259
+ moveListSelection(1);
260
+ } else if (evt.keyCode === 38) {
261
+ moveListSelection(-1);
262
+ }
263
+ }
264
+ }
265
+ function initCommands() {
266
+ optionsCommandSet = {
267
+ //the command names MUST match the commands in the template.html with the "telerik_Reportviewer" prefix so the binder could work.
268
+ "searchDialog_MatchCase": new command(function() {
269
+ toggleCommand(this);
270
+ }),
271
+ "searchDialog_MatchWholeWord": new command(function() {
272
+ toggleCommand(this);
273
+ }),
274
+ "searchDialog_UseRegex": new command(function() {
275
+ toggleCommand(this);
276
+ })
277
+ };
278
+ binder.Binder.bind(
279
+ $searchOptionsPlaceholder,
280
+ {
281
+ controller,
282
+ commands: optionsCommandSet
283
+ },
284
+ viewerOptions
285
+ );
286
+ stopSearchCommand = new command(function() {
287
+ stopSearch();
288
+ });
289
+ binder.Binder.bind(
290
+ $stopSearchPlaceholder,
291
+ {
292
+ controller,
293
+ commands: { "searchDialog_StopSearch": stopSearchCommand }
294
+ },
295
+ viewerOptions
296
+ );
297
+ navigationCommandSet = {
298
+ "searchDialog_NavigateUp": new command(function() {
299
+ moveListSelection(-1);
300
+ }),
301
+ "searchDialog_NavigateDown": new command(function() {
302
+ moveListSelection(1);
303
+ })
304
+ };
305
+ binder.Binder.bind(
306
+ $navigationPlaceholder,
307
+ {
308
+ controller,
309
+ commands: navigationCommandSet
310
+ },
311
+ viewerOptions
312
+ );
313
+ }
314
+ function initResultsArea() {
315
+ try {
316
+ $resultsPlaceholder.kendoListView({
317
+ selectable: true,
318
+ navigatable: true,
319
+ dataSource: {},
320
+ contentElement: "",
321
+ template: "<div class='trv-search-dialog-results-row'><span>#: description #</span> <span class='trv-search-dialog-results-pageSpan'>" + stringResources.stringResources.searchDialogPageText + " #:page#</span></div>",
322
+ change: function() {
323
+ var index = this.select().index();
324
+ var view = this.dataSource.view();
325
+ var dataItem = view[index];
326
+ onSelectedItem(dataItem);
327
+ updateUI(index, view.length);
328
+ }
329
+ });
330
+ } catch (e) {
331
+ console.error("Instantiation of Kendo ListView as search result area threw an exception", e);
332
+ throw e;
333
+ }
334
+ }
335
+ function stopSearch() {
336
+ setStopButtonEnabledState(false);
337
+ }
338
+ function toggleCommand(cmd) {
339
+ cmd.checked(!cmd.checked());
340
+ searchForCurrentToken();
341
+ }
342
+ function setStopButtonEnabledState(enabledState) {
343
+ stopSearchCommand.enabled(enabledState);
344
+ }
345
+ function onPageReady(args, page) {
346
+ if (dialogVisible) {
347
+ colorPageElements(searchResults);
348
+ }
349
+ }
350
+ function onInputFiltering(e) {
351
+ e.preventDefault();
352
+ if (e.filter && e.filter.value !== lastSearch) {
353
+ lastSearch = e.filter.value;
354
+ searchForToken(lastSearch);
355
+ }
356
+ }
357
+ function kendoComboBoxSelect(e) {
358
+ var newValue = e.sender.value();
359
+ if (newValue && lastSearch !== newValue) {
360
+ lastSearch = newValue;
361
+ searchForToken(lastSearch);
362
+ }
363
+ }
364
+ function searchForCurrentToken() {
365
+ if (kendoComboBox) {
366
+ searchForToken(kendoComboBox.value());
367
+ }
368
+ }
369
+ function searchForToken(token) {
370
+ onSearchStarted();
371
+ addToMRU(token);
372
+ controller.getSearchResults(
373
+ {
374
+ searchToken: token,
375
+ matchCase: optionsCommandSet.searchDialog_MatchCase.checked(),
376
+ matchWholeWord: optionsCommandSet.searchDialog_MatchWholeWord.checked(),
377
+ useRegex: optionsCommandSet.searchDialog_UseRegex.checked()
378
+ }
379
+ ).then(function(results) {
380
+ updateResultsUI(results, null);
381
+ }).catch(function(errorMessage) {
382
+ if (errorMessage) {
383
+ updateResultsUI(null, errorMessage);
384
+ }
385
+ });
386
+ }
387
+ function onSearchStarted() {
388
+ $resultsLabel.text(stringResources.stringResources.searchDialogSearchInProgress);
389
+ clearColoredItems();
390
+ searchResults = null;
391
+ setStopButtonEnabledState(true);
392
+ toggleErrorLabel(false, null);
393
+ }
394
+ function updateResultsUI(results, error) {
395
+ setStopButtonEnabledState(false);
396
+ if (error) {
397
+ toggleErrorLabel(true, error);
398
+ }
399
+ displayResultsList(results);
400
+ searchResults = results;
401
+ if (results && results.length > 0) {
402
+ colorPageElements(results);
403
+ selectFirstElement();
404
+ } else {
405
+ updateUI(-1, 0);
406
+ }
407
+ }
408
+ function addToMRU(token) {
409
+ if (!token || token === "") {
410
+ return;
411
+ }
412
+ var exists = mruList.filter(function(mru) {
413
+ return mru.value === token;
414
+ });
415
+ if (exists && exists.length > 0) {
416
+ return;
417
+ }
418
+ mruList.unshift({ value: token });
419
+ if (mruList.length > 10) {
420
+ mruList.pop();
421
+ }
422
+ inputComboRebinding = true;
423
+ kendoComboBox.dataSource.data(mruList);
424
+ kendoComboBox.select(function(item) {
425
+ return item.value === token;
426
+ });
427
+ inputComboRebinding = false;
428
+ }
429
+ function displayResultsList(results) {
430
+ var $listView = $resultsPlaceholder.data("kendoListView");
431
+ if (!results) {
432
+ results = [];
433
+ }
434
+ $listView.dataSource.data(results);
435
+ }
436
+ function colorPageElements(results) {
437
+ if (!results || results.length === 0) {
438
+ return;
439
+ }
440
+ var $parent = $placeholder.parent();
441
+ var $pageContainer = $parent.find(".trv-page-container");
442
+ var elements = $pageContainer.find("[data-search-id]");
443
+ utils.each(results, function() {
444
+ var $searchElement = elements.filter("[data-search-id=" + this.id + "]");
445
+ if ($searchElement) {
446
+ $searchElement.addClass(highlightManager.shadedClassName);
447
+ highlightManager.elements.push($searchElement);
448
+ }
449
+ });
450
+ highlightItem(pendingHighlightItem);
451
+ pendingHighlightItem = null;
452
+ }
453
+ function highlightItem(item) {
454
+ if (item) {
455
+ var currentItemId = item.id;
456
+ var newHighlighted = $(highlightManager.elements.filter(function(i) {
457
+ return i.attr("data-search-id") === currentItemId;
458
+ })).first();
459
+ if (newHighlighted) {
460
+ highlightManager.current = newHighlighted[0];
461
+ if (highlightManager.current) {
462
+ var current = $("[data-search-id='" + currentItemId + "']");
463
+ current.removeClass(highlightManager.shadedClassName);
464
+ current.addClass(highlightManager.highlightedClassName);
465
+ }
466
+ }
467
+ }
468
+ }
469
+ function selectFirstElement() {
470
+ var $listView = $resultsPlaceholder.data("kendoListView");
471
+ var first = $listView.element.children().first();
472
+ $listView.select(first);
473
+ $listView.trigger("change");
474
+ }
475
+ function onSelectedItem(item) {
476
+ if (!item) {
477
+ return;
478
+ }
479
+ if (highlightManager.current) {
480
+ highlightManager.current.removeClass(highlightManager.highlightedClassName);
481
+ highlightManager.current.addClass(highlightManager.shadedClassName);
482
+ }
483
+ if (item.page === controller.getCurrentPageNumber()) {
484
+ highlightItem(item);
485
+ } else {
486
+ if (controller.getPageMode() !== enums.PageModes.CONTINUOUS_SCROLL) {
487
+ clearColoredItems();
488
+ } else {
489
+ highlightItem(item);
490
+ }
491
+ }
492
+ pendingHighlightItem = item;
493
+ controller.navigateToPage(item.page, { type: "search", id: item.id });
494
+ }
495
+ function updateUI(index, count) {
496
+ var str = count === 0 ? stringResources.stringResources.searchDialogNoResultsLabel : utils.stringFormat(stringResources.stringResources.searchDialogResultsFormatLabel, [index + 1, count]);
497
+ $resultsLabel.text(str);
498
+ var allowMoveUp = index > 0;
499
+ var allowMoveDown = index < count - 1;
500
+ navigationCommandSet.searchDialog_NavigateUp.enabled(allowMoveUp);
501
+ navigationCommandSet.searchDialog_NavigateDown.enabled(allowMoveDown);
502
+ }
503
+ function clearColoredItems() {
504
+ if (highlightManager.elements && highlightManager.elements.length > 0) {
505
+ utils.each(highlightManager.elements, function() {
506
+ this.removeClass(highlightManager.shadedClassName);
507
+ });
508
+ }
509
+ if (highlightManager.current) {
510
+ highlightManager.current.removeClass(highlightManager.highlightedClassName);
511
+ }
512
+ highlightManager.elements = [];
513
+ highlightManager.current = null;
514
+ }
515
+ function moveListSelection(offset) {
516
+ var $listView = $resultsPlaceholder.data("kendoListView");
517
+ var $selected = $listView.select();
518
+ if (!$selected) {
519
+ $selected = $listView.element.children().first();
520
+ $listView.select($selected);
521
+ $listView.trigger("change");
522
+ } else {
523
+ var index = $listView.select().trigger("change").index();
524
+ var view = $listView.dataSource.view();
525
+ var newIndex = Math.min(view.length - 1, Math.max(0, index + offset));
526
+ if (newIndex !== index) {
527
+ var dataItem = view[newIndex];
528
+ var element = $listView.element.find('[data-uid="' + dataItem.uid + '"]');
529
+ if (element) {
530
+ $listView.select(element);
531
+ $listView.trigger("change");
532
+ scrollIfNeeded(element[0], $listView.element[0]);
533
+ }
534
+ }
535
+ }
536
+ }
537
+ function scrollIfNeeded(element, container) {
538
+ if (element.offsetTop - element.clientHeight < container.scrollTop) {
539
+ element.scrollIntoView();
540
+ } else {
541
+ var offsetBottom = element.offsetTop + element.offsetHeight;
542
+ var scrollBottom = container.scrollTop + container.offsetHeight;
543
+ if (offsetBottom > scrollBottom) {
544
+ container.scrollTop = offsetBottom - container.offsetHeight;
545
+ }
546
+ }
547
+ }
548
+ function toggleErrorLabel(show, message) {
549
+ var $errorIcon = $searchOptionsPlaceholder.find("i[data-role='telerik_ReportViewer_SearchDialog_Error']");
550
+ if (!$errorIcon || $errorIcon.length === 0) {
551
+ console.log(message);
552
+ return;
553
+ }
554
+ var menuItem = $searchOptionsPlaceholder.data("kendoMenu").element.find("li").last();
555
+ if (show) {
556
+ $errorIcon[0].title = message;
557
+ menuItem.show();
558
+ } else {
559
+ menuItem.hide();
560
+ }
561
+ }
562
+ function replaceStringResources($search) {
563
+ if (!$search) {
564
+ return;
565
+ }
566
+ var $searchCaption = $search.find(".trv-search-dialog-caption-label");
567
+ var $searchOptions = $search.find(".trv-search-dialog-search-options");
568
+ var $searchStopButton = $search.find("a[data-command='telerik_ReportViewer_searchDialog_StopSearch']");
569
+ var $searchMatchCaseButton = $search.find("a[data-command='telerik_ReportViewer_searchDialog_MatchCase']");
570
+ var $searchMatchWholeWordButton = $search.find("a[data-command='telerik_ReportViewer_searchDialog_MatchWholeWord']");
571
+ var $searchUseRegexButton = $search.find("a[data-command='telerik_ReportViewer_searchDialog_UseRegex']");
572
+ var $searchNavigateUpButton = $search.find("a[data-command='telerik_ReportViewer_searchDialog_NavigateUp']");
573
+ var $searchNavigateDownButton = $search.find("a[data-command='telerik_ReportViewer_searchDialog_NavigateDown']");
574
+ replaceAttribute($search, "aria-label");
575
+ replaceAttribute($searchOptions, "aria-label");
576
+ replaceText($searchCaption);
577
+ replaceTitleAndAriaLabel($searchStopButton);
578
+ replaceTitleAndAriaLabel($searchMatchCaseButton);
579
+ replaceTitleAndAriaLabel($searchMatchWholeWordButton);
580
+ replaceTitleAndAriaLabel($searchUseRegexButton);
581
+ replaceTitleAndAriaLabel($searchNavigateUpButton);
582
+ replaceTitleAndAriaLabel($searchNavigateDownButton);
583
+ }
584
+ function replaceTitleAndAriaLabel($a) {
585
+ replaceAttribute($a, "title");
586
+ replaceAttribute($a, "aria-label");
587
+ }
588
+ function replaceText($el) {
589
+ if ($el) {
590
+ $el.text(stringResources.stringResources[$el.text()]);
591
+ }
592
+ }
593
+ function replaceAttribute($el, attribute) {
594
+ if ($el) {
595
+ $el.attr(attribute, stringResources.stringResources[$el.attr(attribute)]);
596
+ }
597
+ }
598
+ function command(execCallback) {
599
+ var enabledState = true;
600
+ var checkedState = false;
601
+ var cmd = {
602
+ enabled: function(state) {
603
+ if (arguments.length === 0) {
604
+ return enabledState;
605
+ }
606
+ var newState = Boolean(state);
607
+ enabledState = newState;
608
+ $(this).trigger("enabledChanged");
609
+ return cmd;
610
+ },
611
+ checked: function(state) {
612
+ if (arguments.length === 0) {
613
+ return checkedState;
614
+ }
615
+ var newState = Boolean(state);
616
+ checkedState = newState;
617
+ $(this).trigger("checkedChanged");
618
+ return cmd;
619
+ },
620
+ exec: execCallback
621
+ };
622
+ return cmd;
623
+ }
624
+ }
625
+ var pluginName = "telerik_ReportViewer_SearchDialog";
626
+ $.fn[pluginName] = function(options, viewerOptions) {
627
+ return utils.each(this, function() {
628
+ if (!$.data(this, pluginName)) {
629
+ $.data(this, pluginName, new Search(this, options, viewerOptions));
630
+ }
631
+ });
632
+ };
633
+
634
+ exports.Search = Search;