@progress/telerik-jquery-report-viewer 31.26.812 → 32.26.1110

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.
@@ -15,6 +15,10 @@ function HistoryManager(options) {
15
15
  addToHistory(true);
16
16
  }).on("currentPageChanged", () => {
17
17
  updatePageInfo();
18
+ }).on("interactiveActionExecuting", (args) => {
19
+ if (args?.action?.Type === "navigateToReport") {
20
+ updateScrollPosition();
21
+ }
18
22
  }).onAsync("reportLoadComplete", async () => {
19
23
  addToHistory(false);
20
24
  }).on("clientExpired", () => {
@@ -48,6 +52,14 @@ function HistoryManager(options) {
48
52
  currentRecord.pageNumber = controller.getCurrentPageNumber();
49
53
  currentRecord.viewMode = controller.getViewMode();
50
54
  currentRecord.reportDocumentId = controller.getReportDocumentId();
55
+ delete currentRecord.scrollPosition;
56
+ saveSettings();
57
+ }
58
+ }
59
+ function updateScrollPosition() {
60
+ var currentRecord = getCurrentRecord();
61
+ if (currentRecord) {
62
+ currentRecord.scrollPosition = controller.getScrollPosition();
51
63
  saveSettings();
52
64
  }
53
65
  }
@@ -69,7 +81,12 @@ function HistoryManager(options) {
69
81
  controller.setViewMode(currentRecord.viewMode);
70
82
  controller.setReportSource(currentRecord.reportSource);
71
83
  controller.refreshReport(false, currentRecord.reportDocumentId, reportChanged);
72
- controller.navigateToPage(currentRecord.pageNumber);
84
+ var scrollPosition = currentRecord.scrollPosition;
85
+ if (scrollPosition) {
86
+ controller.navigateToPage(scrollPosition.pageNumber, scrollPosition);
87
+ } else {
88
+ controller.navigateToPage(currentRecord.pageNumber);
89
+ }
73
90
  }
74
91
  function canMove(step) {
75
92
  var position = history.position;
@@ -89,6 +106,7 @@ function HistoryManager(options) {
89
106
  if (newPos != position) {
90
107
  var currentRecord = getCurrentRecord();
91
108
  var currentReport = currentRecord.reportSource ? currentRecord.reportSource.report : "";
109
+ updateScrollPosition();
92
110
  history.position = newPos;
93
111
  saveSettings();
94
112
  var newRecord = getCurrentRecord();
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var utils = require('./utils.js');
6
- var stringResources = require('./stringResources.js');
7
6
  var RCV = require('@progress/telerik-common-report-viewer');
7
+ var stringResources = require('./stringResources.js');
8
8
 
9
9
  var lastSelectedMenuItem;
10
10
  var lastSelectedSubmenuItem;
@@ -112,11 +112,17 @@ function MainMenu(element, options, viewerOptions) {
112
112
  tabIndex = 1;
113
113
  }
114
114
  $list.empty();
115
- Array.from(formats).forEach((format) => {
115
+ Array.from(formats).forEach((extension) => {
116
+ var format = { name: extension.name, localizedName: RCV.getExportFormatName(extension, stringResources.stringResources) };
116
117
  var ariaLabel = enableAccessibility ? utils.stringFormat('aria-label="{localizedName}" ', format) : " ";
117
- var li = "<li " + ariaLabel + utils.stringFormat('tabindex="' + tabIndex + '"><a tabindex="-1" href="#" data-command="telerik_ReportViewer_export" data-command-parameter="{name}"><span>{localizedName}</span></a></li>', format);
118
+ var icon = utils.renderExportFormatIcon(format.name);
119
+ var li = "<li " + ariaLabel + utils.stringFormat('tabindex="' + tabIndex + '"><a tabindex="-1" href="#" data-command="telerik_ReportViewer_export" data-command-parameter="{name}">' + icon + "<span>{localizedName}</span></a></li>", format);
118
120
  menu.append(li, $parent);
119
121
  });
122
+ if (options.exportDialog.enabled && RCV.hasExportSettings(formats)) {
123
+ var optionsIcon = utils.renderExportOptionsIcon();
124
+ menu.append('<li class="trv-export-options-item" tabindex="' + tabIndex + '"><a tabindex="-1" href="#" data-command="telerik_ReportViewer_openExportDialog">' + optionsIcon + "<span>" + kendo.htmlEncode(stringResources.stringResources.exportOptionsLabel) + "</span></a></li>", $parent);
125
+ }
120
126
  if (enableAccessibility) {
121
127
  setInternalListAccessibilityKeyEvents($parent.find("li"));
122
128
  }
@@ -78,6 +78,7 @@ class NotificationService {
78
78
  GET_SEND_EMAIL_DIALOG_STATE: "trv.GET_SEND_EMAIL_DIALOG_STATE",
79
79
  SET_SEARCH_DIALOG_VISIBLE: "trv.SET_SEARCH_DIALOG_VISIBLE",
80
80
  SET_SEND_EMAIL_DIALOG_VISIBLE: "trv.SET_SEND_EMAIL_DIALOG_VISIBLE",
81
+ SET_EXPORT_DIALOG_VISIBLE: "trv.SET_EXPORT_DIALOG_VISIBLE",
81
82
  SET_AI_PROMPT_DIALOG_VISIBLE: "trv.SET_AI_PROMPT_DIALOG_VISIBLE"
82
83
  };
83
84
  on() {
@@ -120,6 +121,9 @@ class NotificationService {
120
121
  setSendEmailDialogVisible() {
121
122
  return this.eventFactory(this.Events.SET_SEND_EMAIL_DIALOG_VISIBLE, arguments);
122
123
  }
124
+ setExportDialogVisible() {
125
+ return this.eventFactory(this.Events.SET_EXPORT_DIALOG_VISIBLE, arguments);
126
+ }
123
127
  setAiPromptDialogVisible() {
124
128
  return this.eventFactory(this.Events.SET_AI_PROMPT_DIALOG_VISIBLE, arguments);
125
129
  }
@@ -127,10 +127,6 @@ function applyClass(apply, cssClass, item) {
127
127
  function enableItem(item, enable) {
128
128
  applyClass(!enable, "k-disabled", item);
129
129
  }
130
- function selectItem(item, select) {
131
- applyClass(select, "k-selected", item);
132
- item.attr("aria-selected", select);
133
- }
134
130
  function addAccessibilityAttributes(editor, type, caption, additionalInfo, error) {
135
131
  if (!additionalInfo) {
136
132
  additionalInfo = "";
@@ -270,20 +266,23 @@ var ParameterEditors = [
270
266
  }
271
267
  }
272
268
  function getSelectedItems() {
273
- return $(listView.element).find(".k-selected");
269
+ return listView.select();
274
270
  }
275
271
  function onItemClick(e) {
276
272
  if (!enabled)
277
273
  return;
278
- var clickedItem = $(e.target);
279
- var selectedItems = listView.select();
280
- if (clickedItem.hasClass("k-selected")) {
281
- selectedItems.splice($.inArray(clickedItem[0], selectedItems), 1);
274
+ const clickedItem = $(e.target).closest(".trv-listviewitem")[0];
275
+ const selectedItems = listView.select().get();
276
+ const index = selectedItems.indexOf(clickedItem);
277
+ if (index !== -1) {
278
+ selectedItems.splice(index, 1);
282
279
  } else {
283
280
  selectedItems.push(clickedItem);
284
281
  }
285
282
  listView.clearSelection();
286
- listView.select(selectedItems);
283
+ if (selectedItems.length) {
284
+ listView.select(selectedItems);
285
+ }
287
286
  listView.trigger("change");
288
287
  }
289
288
  function onChange(e) {
@@ -295,10 +294,9 @@ var ParameterEditors = [
295
294
  if (event.which !== 32) {
296
295
  return;
297
296
  }
298
- var focused = listView.element.find(".k-focus");
297
+ var focused = listView.element.find(".k-focus, .k-state-focused");
299
298
  if (focused.length > 0) {
300
- focused.toggleClass("k-selected");
301
- onSelectionChanged(getSelectedItems());
299
+ onItemClick({ target: focused[0] });
302
300
  event.preventDefault();
303
301
  }
304
302
  }
@@ -324,7 +322,8 @@ var ParameterEditors = [
324
322
  if (!Array.isArray(items)) {
325
323
  items = [items];
326
324
  }
327
- var children = $list.find(".trv-listviewitem");
325
+ const children = $list.find(".trv-listviewitem");
326
+ const selectedItems = [];
328
327
  $.each(parameter.availableValues, (i, av) => {
329
328
  var selected = false;
330
329
  $.each(items, (j, v) => {
@@ -335,8 +334,14 @@ var ParameterEditors = [
335
334
  selected = utils.areEqual(v, availableValue);
336
335
  return !selected;
337
336
  });
338
- selectItem($(children[i]), selected);
337
+ if (selected) {
338
+ selectedItems.push(children[i]);
339
+ }
339
340
  });
341
+ listView.clearSelection();
342
+ if (selectedItems.length) {
343
+ listView.select(selectedItems);
344
+ }
340
345
  }
341
346
  return {
342
347
  beginEdit: (param) => {
@@ -14,6 +14,7 @@ var documentMapArea = require('./documentMapArea.js');
14
14
  var parametersArea = require('./parametersArea.js');
15
15
  var search = require('./search.js');
16
16
  var sendEmail = require('./sendEmail.js');
17
+ var exportDialog = require('./exportDialog.js');
17
18
  var events = require('./events.js');
18
19
  var perspectives = require('./perspectives.js');
19
20
  var enums = require('./enums.js');
@@ -102,6 +103,7 @@ function getDefaultOptions(serviceUrl, version) {
102
103
  reportSource: null,
103
104
  reportServer: null,
104
105
  authenticationToken: null,
106
+ httpHeaders: null,
105
107
  nonce: null,
106
108
  sendEmail: null,
107
109
  scale: 1,
@@ -126,6 +128,9 @@ function getDefaultOptions(serviceUrl, version) {
126
128
  searchMetadataOnDemand: false,
127
129
  initialPageAreaImageUrl: null,
128
130
  keepClientAlive: true,
131
+ exportDialog: {
132
+ enabled: true
133
+ },
129
134
  webDesignerPreview: false,
130
135
  serverPreview: false
131
136
  };
@@ -147,6 +152,7 @@ function ReportViewer(dom, options) {
147
152
  var persistanceKey = options.id || "#" + $placeholder.attr("id");
148
153
  var accessibility$1;
149
154
  var settings = {};
155
+ var exportSettingsStore = {};
150
156
  var notificationService$1 = {};
151
157
  var client = {};
152
158
  var controllerOptions = {};
@@ -160,8 +166,10 @@ function ReportViewer(dom, options) {
160
166
  if (!validateOptions(options)) {
161
167
  return;
162
168
  }
163
- var version = "20.2.26.812";
164
- options = $.extend({}, getDefaultOptions(svcApiUrl, version), options);
169
+ var version = "20.3.26.1110";
170
+ var defaultOptions = getDefaultOptions(svcApiUrl, version);
171
+ options = $.extend({}, defaultOptions, options);
172
+ options.exportDialog = $.extend({}, defaultOptions.exportDialog, options.exportDialog);
165
173
  settings = new reportViewerSettings.ReportViewerSettings(
166
174
  persistanceKey,
167
175
  options.persistSession ? window.sessionStorage : new memStorage.MemStorage(),
@@ -179,6 +187,8 @@ function ReportViewer(dom, options) {
179
187
  serverPreview: options.serverPreview
180
188
  }
181
189
  );
190
+ exportSettingsStore = new RCV__namespace.ExportSettingsStore();
191
+ exportSettingsStore.setDefaultValues(RCV__namespace.getExportViewerDefaultValues(options));
182
192
  notificationService$1 = new notificationService.NotificationService();
183
193
  client = new RCV__namespace.ServiceClient(options);
184
194
  controllerOptions = new RCV__namespace.ReportControllerOptions(
@@ -206,7 +216,9 @@ function ReportViewer(dom, options) {
206
216
  commands = new commandSet.CommandSet({
207
217
  controller,
208
218
  notificationService: notificationService$1,
209
- history: history$1
219
+ history: history$1,
220
+ exportSettingsStore,
221
+ exportDialog: options.exportDialog
210
222
  });
211
223
  new uiController.UIController({
212
224
  controller,
@@ -439,6 +451,19 @@ function ReportViewer(dom, options) {
439
451
  }
440
452
  return viewer;
441
453
  },
454
+ /**
455
+ * Sets the custom HTTP headers sent with the requests to the REST service. Not supported with Report Server.
456
+ * @function
457
+ * @param {HttpHeadersOptions|null} headers - Header source and refresh interval, or null to clear the headers.
458
+ * @returns {ReportViewerInstance} Returns the viewer instance for chaining.
459
+ * @example // Set a custom header for the viewer requests
460
+ * var viewer = $("#reportViewer1").data("telerik_ReportViewer");
461
+ * viewer.httpHeaders({ headers: { "X-Tenant-Id": "tenant-1" } });
462
+ */
463
+ httpHeaders: (headers) => {
464
+ controller.setHttpHeaders(headers);
465
+ return viewer;
466
+ },
442
467
  /**
443
468
  * Binds event handlers to the specified event.
444
469
  * @function
@@ -635,7 +660,8 @@ function ReportViewer(dom, options) {
635
660
  controller,
636
661
  notificationService: notificationService$1,
637
662
  commands,
638
- templates
663
+ templates,
664
+ exportSettingsStore
639
665
  },
640
666
  options
641
667
  );
@@ -1021,7 +1047,7 @@ function ReportViewer(dom, options) {
1021
1047
  return Promise.resolve();
1022
1048
  }
1023
1049
  var kendoUrl = utils.rTrim(svcApiUrl, "\\/") + "/resources/js/telerikReportViewer.kendo-" + version2 + ".min.js/";
1024
- return fetch(kendoUrl).then((response) => {
1050
+ return client.fetchResource(kendoUrl).then((response) => {
1025
1051
  if (!response.ok) {
1026
1052
  return Promise.reject({ error: "Failed to fetch data - status code " + response.status });
1027
1053
  }
@@ -1112,6 +1138,10 @@ const plugins = [
1112
1138
  name: "telerik_ReportViewer_SendEmail",
1113
1139
  constructor: sendEmail.SendEmail
1114
1140
  },
1141
+ {
1142
+ name: "telerik_ReportViewer_ExportDialog",
1143
+ constructor: exportDialog.ExportDialog
1144
+ },
1115
1145
  {
1116
1146
  name: "telerik_ReportViewer_LinkButton",
1117
1147
  constructor: linkButton.LinkButton
@@ -189,6 +189,9 @@ class Search {
189
189
  },
190
190
  select: this.processComboBoxEvent.bind(this)
191
191
  });
192
+ this.kendoComboBox.element[0]?.setAttribute("aria-label", stringResources.stringResources.ariaLabelSearchDialogInput);
193
+ this.kendoComboBox.input[0]?.setAttribute("aria-label", stringResources.stringResources.ariaLabelSearchDialogInput);
194
+ this.kendoComboBox._arrow[0]?.setAttribute("aria-label", stringResources.stringResources.ariaLabelSearchDialogInputDropdown);
192
195
  }
193
196
  _initDialog() {
194
197
  this.kendoSearchDialog = new kendo.ui.Window(this.element, {
@@ -466,10 +469,8 @@ class Search {
466
469
  }
467
470
  if (show) {
468
471
  $errorIcon[0].title = message;
469
- $errorIcon.show();
470
- } else {
471
- $errorIcon.hide();
472
472
  }
473
+ $errorIcon.toggleClass("k-hidden", !show);
473
474
  }
474
475
  }
475
476
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('@progress/telerik-common-report-viewer');
5
+ var RCV = require('@progress/telerik-common-report-viewer');
6
6
  var stringResources = require('./stringResources.js');
7
7
  var binder = require('./binder.js');
8
8
  var command = require('./command.js');
@@ -100,7 +100,7 @@ class SendEmail {
100
100
  }
101
101
  replaceStringResources(this.$element);
102
102
  this.controller.getDocumentFormats().then((formats) => {
103
- this.docFormatList = formats;
103
+ this.docFormatList = (formats || []).map((format) => ({ ...format, localizedName: RCV.getExportFormatName(format, stringResources.stringResources) }));
104
104
  this.docFormat?.setDataSource(this.docFormatList);
105
105
  if (this.viewerOptions?.sendEmail && this.viewerOptions?.sendEmail.format) {
106
106
  this.docFormat?.value(this.viewerOptions.sendEmail.format);
@@ -238,6 +238,7 @@ class SendEmail {
238
238
  }
239
239
  element.setAttribute("id", `${prefix}-${attrName}`);
240
240
  element.setAttribute("name", `${prefix}-${attrName}`);
241
+ element.setAttribute("aria-label", stringResources.stringResources.sendEmailDialogEmailBody);
241
242
  });
242
243
  Array.from(this.element.querySelectorAll(".trv-send-email-label label")).forEach((element) => {
243
244
  var attrFor = element.getAttribute("for");
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var utils = require('./utils.js');
6
+ var RCV = require('@progress/telerik-common-report-viewer');
6
7
  var stringResources = require('./stringResources.js');
7
8
 
8
9
  function SideMenu(element, options, viewerOptions) {
@@ -85,11 +86,17 @@ function SideMenu(element, options, viewerOptions) {
85
86
  tabIndex = DEFAULT_TABINDEX;
86
87
  }
87
88
  $list.empty();
88
- Array.from(formats).forEach((format) => {
89
+ Array.from(formats).forEach((extension) => {
90
+ var format = { name: extension.name, localizedName: RCV.getExportFormatName(extension, stringResources.stringResources) };
89
91
  var ariaLabel = enableAccessibility ? utils.stringFormat('aria-label="{localizedName}" ', format) : " ";
90
- var li = "<li " + ariaLabel + utils.stringFormat('tabindex="' + tabIndex + '"><a tabindex="-1" href="#" data-command="telerik_ReportViewer_export" data-command-parameter="{name}"><span>{localizedName}</span></a></li>', format);
92
+ var icon = utils.renderExportFormatIcon(format.name);
93
+ var li = "<li " + ariaLabel + utils.stringFormat('tabindex="' + tabIndex + '"><a tabindex="-1" href="#" data-command="telerik_ReportViewer_export" data-command-parameter="{name}">' + icon + "<span>{localizedName}</span></a></li>", format);
91
94
  panelBar.append(li, $parent);
92
95
  });
96
+ if (options.exportDialog.enabled && RCV.hasExportSettings(formats)) {
97
+ var optionsIcon = utils.renderExportOptionsIcon();
98
+ panelBar.append('<li class="trv-export-options-item" tabindex="' + tabIndex + '"><a tabindex="-1" href="#" data-command="telerik_ReportViewer_openExportDialog">' + optionsIcon + "<span>" + kendo.htmlEncode(stringResources.stringResources.exportOptionsLabel) + "</span></a></li>", $parent);
99
+ }
93
100
  setListItemsTabIndex($parent.find("li"), tabIndex);
94
101
  enableCloseOnClick($parent);
95
102
  });
package/dist/cjs/sr.js CHANGED
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ var RCV = require('@progress/telerik-common-report-viewer');
4
+
3
5
  var sr = {
4
6
  // Warning and error string resources
5
7
  controllerNotInitialized: "Controller is not initialized.",
@@ -87,6 +89,30 @@ var sr = {
87
89
  sendEmailFormatLabel: "Format:",
88
90
  sendEmailSendLabel: "Send",
89
91
  sendEmailCancelLabel: "Cancel",
92
+ exportDialogSaveLabel: "Save",
93
+ exportDialogCloseLabel: "Cancel",
94
+ exportDialogFormatLabel: "Export format",
95
+ exportOptionsLabel: "Export Options",
96
+ exportDialogResetLabel: "Reset",
97
+ exportDialogSettingsSuffix: " Settings",
98
+ exportDialogDocumentationLabel: "Documentation",
99
+ exportDialogTextPlaceholder: "Enter text",
100
+ exportDialogNoSettings: "This export format has no configurable settings.",
101
+ exportDialogPagesLabel: "Pages",
102
+ exportDialogAllPagesLabel: "All pages",
103
+ exportDialogPageRangeLabel: "Page range",
104
+ exportDialogPageRangePlaceholder: "e.g., 1-5 or 8",
105
+ exportDialogPageRangeInvalid: "Enter a single page or a page range, e.g., 8 or 2-6.",
106
+ exportDialogSwitchOnLabel: "On",
107
+ exportDialogSwitchOffLabel: "Off",
108
+ exportDialogPasswordPlaceholder: "Enter password",
109
+ exportDialogConfirmPasswordLabel: "Confirm password",
110
+ exportDialogConfirmPasswordPlaceholder: "Re-enter password",
111
+ exportDialogPasswordMismatch: "Passwords do not match.",
112
+ exportDialogPasswordRequired: "Enter a password.",
113
+ exportDialogValueRequired: "Enter a value.",
114
+ exportDialogCustomOption: "Custom",
115
+ exportDialogMustDiffer: "{0} must differ from {1}.",
90
116
  // Accessibility string resources
91
117
  ariaLabelPageNumberSelector: "Page number selector. Showing page {0} of {1}.",
92
118
  ariaLabelPageNumberEditor: "Page number editor",
@@ -114,6 +140,8 @@ var sr = {
114
140
  ariaLabelSearchDialogArea: "Search area",
115
141
  ariaLabelAiPromptDialogArea: "AI prompt area",
116
142
  ariaLabelSendEmailDialogArea: "Send email area",
143
+ ariaLabelSearchDialogInput: "Search input",
144
+ ariaLabelSearchDialogInputDropdown: "Previous searches",
117
145
  ariaLabelSearchDialogStop: "Stop search",
118
146
  ariaLabelSearchDialogOptions: "Search options",
119
147
  ariaLabelSearchDialogNavigateUp: "Navigate up",
@@ -149,6 +177,12 @@ var sr = {
149
177
  ariaLabelSendEmailFormat: "Report format:",
150
178
  ariaLabelSendEmailSend: "Send email",
151
179
  ariaLabelSendEmailCancel: "Cancel sending email",
180
+ // Export dialog accessibility resources
181
+ ariaLabelExportDialogArea: "Export settings dialog",
182
+ ariaLabelExportDialogFormat: "Export format",
183
+ ariaLabelExportDialogSave: "Save export options",
184
+ ariaLabelExportDialogClose: "Cancel export options",
185
+ ariaLabelExportDialogReset: "Reset export settings",
152
186
  // Search dialog resources
153
187
  searchDialogTitle: "Search in report contents",
154
188
  searchDialogSearchInProgress: "searching...",
@@ -164,18 +198,23 @@ var sr = {
164
198
  searchDialogPageText: "page",
165
199
  // Send Email dialog resources
166
200
  sendEmailDialogTitle: "Send Email",
201
+ sendEmailDialogEmailBody: "Email body textarea",
167
202
  sendEmailValidationEmailRequired: "Email field is required",
168
203
  sendEmailValidationEmailFormat: "Email format is not valid",
169
204
  sendEmailValidationSingleEmail: "The field accepts a single email address only",
170
205
  sendEmailValidationFormatRequired: "Format field is required",
171
206
  errorSendingDocument: "Error sending report document (Report = '{0}').",
207
+ // Export dialog resources
208
+ exportDialogTitle: "Export Options",
172
209
  // AI Prompt dialog resources
173
210
  aiPromptDialogConsentTitle: "Before you start with AI",
174
211
  aiPromptDialogConsentAccept: "Consent",
175
212
  aiPromptDialogConsentReject: "Cancel",
176
213
  aiPromptDialogTextAreaPlaceholder: "Enter your prompt",
177
214
  aiPromptDialogNoPredefinedAndCustomPromptsPlaceholder: "Custom prompts are disabled and there are no predefined prompts configured. Please allow custom prompts or add predefined prompts to use the AI feature.",
178
- aiPromptDialogNoCustomPromptsPlaceholder: "Custom prompts are disabled, please select one of the predefined suggestions below"
215
+ aiPromptDialogNoCustomPromptsPlaceholder: "Custom prompts are disabled, please select one of the predefined suggestions below",
216
+ // Export formats and export settings resources, keyed as Prefix_[FORMAT_]Name[_Value]
217
+ ...RCV.exportSettingsResources
179
218
  };
180
219
  window.telerikReportViewer ||= {};
181
220
  window.telerikReportViewer.sr ||= sr;
@@ -4,6 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var utils = require('./utils.js');
6
6
 
7
+ const notificationWarningIcon = {
8
+ name: "warning-circle",
9
+ content: '<circle cx="256" cy="256" r="208" fill="none" stroke="currentColor" stroke-width="32" /><path d="M224 128h64v160h-64zm0 256v-64h64v64z" />',
10
+ viewBox: "0 0 512 512"
11
+ };
7
12
  const TemplateCache = /* @__PURE__ */ (function() {
8
13
  var cache = {};
9
14
  return {
@@ -19,7 +24,19 @@ const TemplateCache = /* @__PURE__ */ (function() {
19
24
  var viewerTemplate = $("<div></div>").html(html);
20
25
  Array.from(viewerTemplate.find("template")).forEach((element) => {
21
26
  var $element = $(element);
22
- templates[$element.attr("id")] = utils.trim($element.html(), "\n ");
27
+ var $content = $("<div></div>").html($element.html());
28
+ $content.find("[data-svg-icon]").each((_, icon) => {
29
+ var $icon = $(icon);
30
+ var iconName = $icon.attr("data-svg-icon");
31
+ var exportName = iconName.replace(/-([a-z])/g, (_2, letter) => letter.toUpperCase()) + "Icon";
32
+ var svgIcon = iconName === "warning-circle" ? notificationWarningIcon : kendo.ui.svgIcons[exportName];
33
+ if (!svgIcon) {
34
+ throw new Error(`Kendo SVG icon not found: ${iconName}`);
35
+ }
36
+ kendo.ui.icon($icon, { icon: svgIcon, type: "svg" });
37
+ $icon.removeAttr("data-svg-icon");
38
+ });
39
+ templates[$element.attr("id")] = utils.trim($content.html(), "\n ");
23
40
  });
24
41
  Array.from(viewerTemplate.find("link")).forEach((element) => {
25
42
  styleSheets.push(utils.trim(element.outerHTML, "\n "));
@@ -25,9 +25,10 @@ class PageNumberInput extends baseComponent.BaseComponent {
25
25
  spin: this._onChange.bind(this)
26
26
  });
27
27
  this._numeric._text[0].dataset.role = "telerik_ReportViewer_PageNumberInput";
28
+ this._numeric._text[0].setAttribute("aria-label", stringResources.stringResources.ariaLabelPageNumberEditor);
28
29
  this._numeric.element[0].dataset.role = "";
30
+ this._numeric.element[0].setAttribute("aria-label", stringResources.stringResources.ariaLabelPageNumberEditor);
29
31
  this._numeric.wrapper[0].classList.add("trv-toolbar-numeric");
30
- this._numeric._text[0].setAttribute("aria-label", stringResources.stringResources.ariaLabelPageNumberEditor);
31
32
  this.options.controller.onAsync("reportLoadComplete", async (reportInfo) => {
32
33
  this._numeric.max(reportInfo.pageCount);
33
34
  this._numeric.min(Math.min(1, reportInfo.pageCount));
@@ -2,10 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var RCV = require('@progress/telerik-common-report-viewer');
5
6
  var stringResources = require('./stringResources.js');
6
7
  var pageCountLabel = require('./toolbar/page-count-label.js');
7
8
  var pageNumberInput = require('./toolbar/page-number-input.js');
8
9
  var constants = require('./constants.js');
10
+ var utils = require('./utils.js');
9
11
 
10
12
  function replaceStringResources($toolbar) {
11
13
  if (!$toolbar) {
@@ -27,6 +29,7 @@ class Toolbar {
27
29
  _options;
28
30
  /** @type {HTMLElement} */
29
31
  _element;
32
+ _exportDialogEnabled;
30
33
  $element;
31
34
  _kendoToolbar;
32
35
  _neverOverflowToolBarButtons = ["goToPrevPage", "goToNextPage"];
@@ -35,6 +38,7 @@ class Toolbar {
35
38
  constructor(element, options, viewerOptions) {
36
39
  this._element = element;
37
40
  this._options = options;
41
+ this._exportDialogEnabled = Boolean(viewerOptions.exportDialog.enabled);
38
42
  this.$element = $(this._element);
39
43
  if (this._kendoToolbar === void 0) {
40
44
  this.initKendoToolbar();
@@ -185,14 +189,31 @@ class Toolbar {
185
189
  return;
186
190
  }
187
191
  const exportDropdownItems = [];
188
- extensions.forEach((extension) => exportDropdownItems.push({
189
- id: extension.name,
190
- text: extension.localizedName,
191
- attributes: {
192
- [constants.ToolBarConstants.DataCommandAttr]: "export",
193
- [constants.ToolBarConstants.DataCommandParameterAttr]: extension.name
192
+ extensions.forEach((extension) => {
193
+ const iconClass = utils.getRenderingExtensionIconClass(extension.name);
194
+ const item = {
195
+ id: extension.name,
196
+ text: RCV.getExportFormatName(extension, stringResources.stringResources),
197
+ attributes: {
198
+ [constants.ToolBarConstants.DataCommandAttr]: "export",
199
+ [constants.ToolBarConstants.DataCommandParameterAttr]: extension.name
200
+ }
201
+ };
202
+ if (iconClass) {
203
+ item.spriteCssClass = `rendering-extension-icon ${iconClass}`;
194
204
  }
195
- }));
205
+ exportDropdownItems.push(item);
206
+ });
207
+ if (this._exportDialogEnabled && RCV.hasExportSettings(extensions)) {
208
+ exportDropdownItems.push({
209
+ text: stringResources.stringResources.exportOptionsLabel,
210
+ spriteCssClass: `rendering-extension-icon ${utils.getExportOptionsIconClass()}`,
211
+ attributes: {
212
+ class: "trv-export-options-item",
213
+ [constants.ToolBarConstants.DataCommandAttr]: "openExportDialog"
214
+ }
215
+ });
216
+ }
196
217
  const options = kendoExportDropDown.options;
197
218
  options.items = exportDropdownItems;
198
219
  kendoExportDropDown.setOptions(options);
package/dist/cjs/utils.js CHANGED
@@ -5,6 +5,19 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var RCV = require('@progress/telerik-common-report-viewer');
6
6
 
7
7
  var stringFormatRegExp = /{(\w+?)}/g;
8
+ var renderingExtensionIconClasses = {
9
+ PDF: "rendering-extension-pdf-icon",
10
+ IMAGE: "rendering-extension-image-icon",
11
+ CSV: "rendering-extension-csv-icon",
12
+ DOCX: "rendering-extension-docx-icon",
13
+ MHTML: "rendering-extension-mhtml-icon",
14
+ PPTX: "rendering-extension-pptx-icon",
15
+ RTF: "rendering-extension-rtf-icon",
16
+ XLS: "rendering-extension-xls-icon",
17
+ XLSX: "rendering-extension-xlsx-icon",
18
+ XPS: "rendering-extension-xps-icon"
19
+ };
20
+ var exportOptionsIconClass = "rendering-extension-options-icon";
8
21
  var specialKeys = {
9
22
  DELETE: 46,
10
23
  BACKSPACE: 8,
@@ -67,6 +80,21 @@ function generateGuidString() {
67
80
  return v.toString(16);
68
81
  });
69
82
  }
83
+ function getRenderingExtensionIconClass(format) {
84
+ return typeof format === "string" ? renderingExtensionIconClasses[format.toUpperCase()] || "" : "";
85
+ }
86
+ function getExportOptionsIconClass() {
87
+ return exportOptionsIconClass;
88
+ }
89
+ function renderExportIcon(icon) {
90
+ return icon ? kendo.ui.icon({ icon, type: "svg", iconClass: "trv-export-format-icon" }) : "";
91
+ }
92
+ function renderExportFormatIcon(format) {
93
+ return renderExportIcon(RCV.getExportFormatIcon(format));
94
+ }
95
+ function renderExportOptionsIcon() {
96
+ return renderExportIcon(RCV.EXPORT_OPTIONS_ICON);
97
+ }
70
98
  function trim(s, charlist) {
71
99
  return rTrim(lTrim(s, charlist), charlist);
72
100
  }
@@ -261,6 +289,8 @@ exports.filterUniqueLastOccurrence = filterUniqueLastOccurrence;
261
289
  exports.generateGuidString = generateGuidString;
262
290
  exports.getColorAlphaValue = getColorAlphaValue;
263
291
  exports.getExceptionInstance = getExceptionInstance;
292
+ exports.getExportOptionsIconClass = getExportOptionsIconClass;
293
+ exports.getRenderingExtensionIconClass = getRenderingExtensionIconClass;
264
294
  exports.isApplicationException = isApplicationException;
265
295
  exports.isApplicationExceptionInstance = isApplicationExceptionInstance;
266
296
  exports.isRgbColor = isRgbColor;
@@ -270,6 +300,8 @@ exports.logError = logError;
270
300
  exports.parseJSON = parseJSON;
271
301
  exports.rTrim = rTrim;
272
302
  exports.rectangle = rectangle;
303
+ exports.renderExportFormatIcon = renderExportFormatIcon;
304
+ exports.renderExportOptionsIcon = renderExportOptionsIcon;
273
305
  exports.replaceAll = replaceAll;
274
306
  exports.stringFormat = stringFormat;
275
307
  exports.toRgbColor = toRgbColor;