@progress/telerik-jquery-report-viewer 25.25.211 → 26.25.521

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