@progress/telerik-jquery-report-viewer 31.26.1007 → 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();
@@ -112,16 +112,15 @@ 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 iconClass = utils.getRenderingExtensionIconClass(format.name);
118
- var icon = iconClass ? '<span aria-hidden="true" class="k-sprite rendering-extension-icon ' + iconClass + '"></span>' : "";
118
+ var icon = utils.renderExportFormatIcon(format.name);
119
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);
120
120
  menu.append(li, $parent);
121
121
  });
122
122
  if (options.exportDialog.enabled && RCV.hasExportSettings(formats)) {
123
- var optionsIconClass = utils.getExportOptionsIconClass();
124
- var optionsIcon = '<span aria-hidden="true" class="k-sprite rendering-extension-icon ' + optionsIconClass + '"></span>';
123
+ var optionsIcon = utils.renderExportOptionsIcon();
125
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);
126
125
  }
127
126
  if (enableAccessibility) {
@@ -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) => {
@@ -103,6 +103,7 @@ function getDefaultOptions(serviceUrl, version) {
103
103
  reportSource: null,
104
104
  reportServer: null,
105
105
  authenticationToken: null,
106
+ httpHeaders: null,
106
107
  nonce: null,
107
108
  sendEmail: null,
108
109
  scale: 1,
@@ -165,7 +166,7 @@ function ReportViewer(dom, options) {
165
166
  if (!validateOptions(options)) {
166
167
  return;
167
168
  }
168
- var version = "20.2.26.1007";
169
+ var version = "20.3.26.1110";
169
170
  var defaultOptions = getDefaultOptions(svcApiUrl, version);
170
171
  options = $.extend({}, defaultOptions, options);
171
172
  options.exportDialog = $.extend({}, defaultOptions.exportDialog, options.exportDialog);
@@ -187,6 +188,7 @@ function ReportViewer(dom, options) {
187
188
  }
188
189
  );
189
190
  exportSettingsStore = new RCV__namespace.ExportSettingsStore();
191
+ exportSettingsStore.setDefaultValues(RCV__namespace.getExportViewerDefaultValues(options));
190
192
  notificationService$1 = new notificationService.NotificationService();
191
193
  client = new RCV__namespace.ServiceClient(options);
192
194
  controllerOptions = new RCV__namespace.ReportControllerOptions(
@@ -449,6 +451,19 @@ function ReportViewer(dom, options) {
449
451
  }
450
452
  return viewer;
451
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
+ },
452
467
  /**
453
468
  * Binds event handlers to the specified event.
454
469
  * @function
@@ -1032,7 +1047,7 @@ function ReportViewer(dom, options) {
1032
1047
  return Promise.resolve();
1033
1048
  }
1034
1049
  var kendoUrl = utils.rTrim(svcApiUrl, "\\/") + "/resources/js/telerikReportViewer.kendo-" + version2 + ".min.js/";
1035
- return fetch(kendoUrl).then((response) => {
1050
+ return client.fetchResource(kendoUrl).then((response) => {
1036
1051
  if (!response.ok) {
1037
1052
  return Promise.reject({ error: "Failed to fetch data - status code " + response.status });
1038
1053
  }
@@ -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);
@@ -86,16 +86,15 @@ function SideMenu(element, options, viewerOptions) {
86
86
  tabIndex = DEFAULT_TABINDEX;
87
87
  }
88
88
  $list.empty();
89
- Array.from(formats).forEach((format) => {
89
+ Array.from(formats).forEach((extension) => {
90
+ var format = { name: extension.name, localizedName: RCV.getExportFormatName(extension, stringResources.stringResources) };
90
91
  var ariaLabel = enableAccessibility ? utils.stringFormat('aria-label="{localizedName}" ', format) : " ";
91
- var iconClass = utils.getRenderingExtensionIconClass(format.name);
92
- var icon = iconClass ? '<span aria-hidden="true" class="k-sprite rendering-extension-icon ' + iconClass + '"></span>' : "";
92
+ var icon = utils.renderExportFormatIcon(format.name);
93
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);
94
94
  panelBar.append(li, $parent);
95
95
  });
96
96
  if (options.exportDialog.enabled && RCV.hasExportSettings(formats)) {
97
- var optionsIconClass = utils.getExportOptionsIconClass();
98
- var optionsIcon = '<span aria-hidden="true" class="k-sprite rendering-extension-icon ' + optionsIconClass + '"></span>';
97
+ var optionsIcon = utils.renderExportOptionsIcon();
99
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);
100
99
  }
101
100
  setListItemsTabIndex($parent.find("li"), tabIndex);
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.",
@@ -97,8 +99,20 @@ var sr = {
97
99
  exportDialogTextPlaceholder: "Enter text",
98
100
  exportDialogNoSettings: "This export format has no configurable settings.",
99
101
  exportDialogPagesLabel: "Pages",
100
- exportDialogAllPagesLabel: "All Pages",
101
- exportDialogPageRangeLabel: "Page Range",
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}.",
102
116
  // Accessibility string resources
103
117
  ariaLabelPageNumberSelector: "Page number selector. Showing page {0} of {1}.",
104
118
  ariaLabelPageNumberEditor: "Page number editor",
@@ -198,7 +212,9 @@ var sr = {
198
212
  aiPromptDialogConsentReject: "Cancel",
199
213
  aiPromptDialogTextAreaPlaceholder: "Enter your prompt",
200
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.",
201
- 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
202
218
  };
203
219
  window.telerikReportViewer ||= {};
204
220
  window.telerikReportViewer.sr ||= sr;
@@ -193,7 +193,7 @@ class Toolbar {
193
193
  const iconClass = utils.getRenderingExtensionIconClass(extension.name);
194
194
  const item = {
195
195
  id: extension.name,
196
- text: extension.localizedName,
196
+ text: RCV.getExportFormatName(extension, stringResources.stringResources),
197
197
  attributes: {
198
198
  [constants.ToolBarConstants.DataCommandAttr]: "export",
199
199
  [constants.ToolBarConstants.DataCommandParameterAttr]: extension.name
package/dist/cjs/utils.js CHANGED
@@ -86,6 +86,15 @@ function getRenderingExtensionIconClass(format) {
86
86
  function getExportOptionsIconClass() {
87
87
  return exportOptionsIconClass;
88
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
+ }
89
98
  function trim(s, charlist) {
90
99
  return rTrim(lTrim(s, charlist), charlist);
91
100
  }
@@ -291,6 +300,8 @@ exports.logError = logError;
291
300
  exports.parseJSON = parseJSON;
292
301
  exports.rTrim = rTrim;
293
302
  exports.rectangle = rectangle;
303
+ exports.renderExportFormatIcon = renderExportFormatIcon;
304
+ exports.renderExportOptionsIcon = renderExportOptionsIcon;
294
305
  exports.replaceAll = replaceAll;
295
306
  exports.stringFormat = stringFormat;
296
307
  exports.toRgbColor = toRgbColor;