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