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

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 CHANGED
@@ -20,6 +20,8 @@ Major features:
20
20
 
21
21
  This version of Telerik jQuery Report Viewer requires either Telerik Report Server or Telerik Reporting REST Service _REPORTING_VERSION_PLACEHOLDER_.
22
22
 
23
+ The viewer uses Kendo SVG icons. Its templates and distribution do not require the ReportingIcons font or the `fonticons` stylesheet.
24
+
23
25
  Learn more about Telerik Reporting Viewers here: [Telerik Report Viewers Overview](https://docs.telerik.com/reporting/embedding-reports/display-reports-in-applications/overview)
24
26
 
25
27
  ## License
@@ -43,6 +43,22 @@ function CommandSet(options) {
43
43
  if (!historyManager) {
44
44
  throw "No options.history.";
45
45
  }
46
+ var exportSettingsStore = options.exportSettingsStore;
47
+ var exportDialogEnabled = Boolean(options.exportDialog.enabled);
48
+ var hasConfigurableExportSettings = false;
49
+ var openExportDialogCommand = new command.Command(() => {
50
+ if (exportDialogEnabled && hasConfigurableExportSettings) {
51
+ notificationService.setExportDialogVisible({ visible: true });
52
+ }
53
+ }).setEnabled(false);
54
+ controller.on("beginLoadReport", () => {
55
+ hasConfigurableExportSettings = false;
56
+ openExportDialogCommand.setEnabled(false);
57
+ }).onAsync("reportLoadComplete", async (info) => {
58
+ const extensions = Array.isArray(info?.renderingExtensions) ? info.renderingExtensions : await Promise.resolve(controller.getDocumentFormats());
59
+ hasConfigurableExportSettings = RCV__namespace.hasExportSettings(extensions);
60
+ openExportDialogCommand.setEnabled(exportDialogEnabled && hasConfigurableExportSettings);
61
+ });
46
62
  function getDocumentMapVisible() {
47
63
  var args = {};
48
64
  notificationService.getDocumentMapState(args);
@@ -103,9 +119,16 @@ function CommandSet(options) {
103
119
  }),
104
120
  "export": new command.Command((format) => {
105
121
  if (format) {
106
- controller.exportReport(format);
122
+ Promise.resolve(controller.getDocumentFormats()).then((formats) => {
123
+ const extension = (formats || []).find((item) => item.name === format);
124
+ const deviceInfo = extension && exportSettingsStore ? exportSettingsStore.getDeviceInfo(format, extension.settings || []) : {};
125
+ controller.exportReport(format, deviceInfo);
126
+ }).catch((error) => {
127
+ controller.trigger("error", { message: error });
128
+ });
107
129
  }
108
130
  }),
131
+ "openExportDialog": openExportDialogCommand,
109
132
  "print": new command.Command(() => {
110
133
  controller.printReport();
111
134
  }),
@@ -0,0 +1,581 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var RCV = require('@progress/telerik-common-report-viewer');
6
+ var stringResources = require('./stringResources.js');
7
+ var binder = require('./binder.js');
8
+ var command = require('./command.js');
9
+ var utils = require('./utils.js');
10
+
11
+ const PAGE_SELECTION_FIELD = "__trvPageSelection";
12
+ function replaceStringResources($dialog) {
13
+ if (!$dialog) {
14
+ return;
15
+ }
16
+ const labels = $dialog.find(".trv-replace-string");
17
+ if (labels.length) {
18
+ Array.from(labels).forEach((element) => {
19
+ const $element = $(element);
20
+ const stringResource = stringResources.stringResources[$element.text()];
21
+ if (stringResource) {
22
+ $element.text(stringResource);
23
+ }
24
+ });
25
+ }
26
+ const ariaLabels = $dialog.find("[aria-label]").add($dialog);
27
+ if (ariaLabels.length) {
28
+ Array.from(ariaLabels).forEach((element) => {
29
+ const $element = $(element);
30
+ const stringResource = stringResources.stringResources[$element.attr("aria-label")];
31
+ if (stringResource) {
32
+ $element.attr("aria-label", stringResource);
33
+ }
34
+ });
35
+ }
36
+ }
37
+ function isPasswordSetting(name) {
38
+ return typeof name === "string" && name.toLowerCase().includes("password");
39
+ }
40
+ function createEditorInput(container, options, type) {
41
+ return $("<input />").attr({
42
+ id: options.field,
43
+ name: options.field,
44
+ type,
45
+ "data-bind": `${type === "checkbox" ? "checked" : "value"}:${options.field}`
46
+ }).appendTo(container);
47
+ }
48
+ function createPasswordEditor(container, options) {
49
+ createEditorInput(container, options, "password").attr("autocomplete", "new-password").kendoTextBox({ enable: options.editorOptions.enabled });
50
+ }
51
+ function createDropDownEditor(container, options) {
52
+ createEditorInput(container, options, "text").kendoDropDownList({
53
+ dataSource: options.editorOptions.dataSource,
54
+ enable: options.editorOptions.enabled
55
+ });
56
+ }
57
+ function createCheckBoxEditor(container, options) {
58
+ container.closest(".k-form-field").addClass("trv-export-boolean-field");
59
+ createEditorInput(container, options, "checkbox").kendoCheckBox({
60
+ enabled: options.editorOptions.enabled
61
+ });
62
+ }
63
+ function createNumericEditor(container, options) {
64
+ createEditorInput(container, options, "text").kendoNumericTextBox({
65
+ format: "n0",
66
+ decimals: 0,
67
+ min: 0,
68
+ step: 1,
69
+ autoAdjust: true,
70
+ enable: options.editorOptions.enabled
71
+ });
72
+ }
73
+ function createTextEditor(container, options) {
74
+ createEditorInput(container, options, "text").kendoTextBox({
75
+ placeholder: stringResources.stringResources.exportDialogTextPlaceholder,
76
+ enable: options.editorOptions.enabled
77
+ });
78
+ }
79
+ function createPageSelectionEditor(container, options) {
80
+ const optionName = `${options.field}-${kendo.guid()}`;
81
+ container.closest(".k-form-field").addClass("trv-export-page-selection");
82
+ [
83
+ { selected: false, text: options.editorOptions.allPagesLabel },
84
+ { selected: true, text: options.editorOptions.pageRangeLabel }
85
+ ].forEach((pageOption) => {
86
+ const inputId = kendo.guid();
87
+ const option = $('<label class="trv-export-page-option"></label>').appendTo(container);
88
+ const input = $('<input type="radio" />').attr({
89
+ id: inputId,
90
+ name: optionName,
91
+ [kendo.attr("skip")]: true
92
+ }).appendTo(option).kendoRadioButton({ checked: pageOption.selected === options.editorOptions.pageRangeSelected });
93
+ $("<span></span>").text(pageOption.text).appendTo(option);
94
+ input.on("change", () => options.editorOptions.change(pageOption.selected, options.model));
95
+ });
96
+ }
97
+ class ExportDialog {
98
+ // #region fields
99
+ // #endregion
100
+ // #region constructor
101
+ constructor(element, options, viewerOptions) {
102
+ this.options = options;
103
+ this.viewerOptions = viewerOptions;
104
+ this.element = element;
105
+ this.$element = $(element);
106
+ this.controller = options.controller;
107
+ this.notificationService = options.notificationService;
108
+ this.exportSettingsStore = options.exportSettingsStore;
109
+ this.initialized = false;
110
+ this.dialogVisible = false;
111
+ this.format = "";
112
+ this.formats = [];
113
+ this.pendingValues = {};
114
+ this.initialValues = {};
115
+ this.formatDrawer = void 0;
116
+ this.settingsForm = void 0;
117
+ this.currentValues = void 0;
118
+ this.pagingSettingNames = [];
119
+ this.windowLocation = void 0;
120
+ if (!this.controller) {
121
+ throw "No controller (telerikReporting.ReportViewerController) has been specified.";
122
+ }
123
+ if (!this.notificationService) {
124
+ throw "No notificationService (telerikReporting.NotificationService) has been specified.";
125
+ }
126
+ this.init();
127
+ }
128
+ // #endregion
129
+ // #region methods
130
+ init() {
131
+ if (this.initialized) {
132
+ return;
133
+ }
134
+ replaceStringResources(this.$element);
135
+ this.$settingsContainer = this.$element.find(".trv-export-dialog-settings");
136
+ this.$noSettingsMessage = this.$element.find(".trv-export-dialog-no-settings");
137
+ this.$formatSelector = this.$element.find(".trv-export-dialog-formats");
138
+ this._initDialog();
139
+ this._attachCommands();
140
+ this._attachEvents();
141
+ this.initialized = true;
142
+ }
143
+ _initDialog() {
144
+ this.phoneViewport = this.isPhoneViewport();
145
+ this.kendoExportDialog = new kendo.ui.Window(this.element, {
146
+ title: stringResources.stringResources.exportDialogTitle,
147
+ visible: false,
148
+ draggable: !this.phoneViewport,
149
+ resizable: true,
150
+ modal: true,
151
+ close: () => {
152
+ this.storeDialogPosition();
153
+ },
154
+ open: () => {
155
+ this.updateDialogViewport();
156
+ this.adjustDialogPosition();
157
+ },
158
+ resize: () => {
159
+ kendo.resize(this.$element, true);
160
+ },
161
+ deactivate: () => {
162
+ this.notificationService.setExportDialogVisible({ visible: false });
163
+ }
164
+ });
165
+ this.kendoExportDialog.element.removeClass("trv-export-dialog k-hidden");
166
+ this.kendoExportDialog.wrapper.addClass("trv-export-dialog");
167
+ this.kendoExportDialog.wrapper.find(".k-window-title").prepend(
168
+ $('<span aria-hidden="true"></span>').addClass(
169
+ `k-sprite rendering-extension-icon ${utils.getExportOptionsIconClass()}`
170
+ )
171
+ );
172
+ this.$element.find(".trv-export-dialog-reset").kendoButton({
173
+ icon: "arrow-rotate-cw",
174
+ fillMode: "flat",
175
+ themeColor: "base"
176
+ });
177
+ this.$element.find(".trv-export-dialog-documentation").attr("title", stringResources.stringResources.exportDialogDocumentationLabel).prepend(kendo.ui.icon({ icon: "hyperlink-open" }));
178
+ this.$element.find('[data-command="telerik_ReportViewer_exportDialog_Close"]').kendoButton({
179
+ fillMode: "solid",
180
+ themeColor: "base"
181
+ });
182
+ this.$element.find('[data-command="telerik_ReportViewer_exportDialog_Save"]').kendoButton({
183
+ fillMode: "solid",
184
+ themeColor: "primary"
185
+ });
186
+ this.$settingsContainer.kendoTooltip({
187
+ filter: ".trv-export-setting-info",
188
+ showOn: "mouseenter focus",
189
+ position: "top",
190
+ content: (event) => $('<span class="trv-export-setting-tooltip-text"></span>').text(event.target.attr("data-description") || "")[0].outerHTML
191
+ });
192
+ }
193
+ _attachCommands() {
194
+ this.optionsCommandSet = {
195
+ "exportDialog_Close": new command.Command(() => {
196
+ this.close();
197
+ }),
198
+ "exportDialog_Save": new command.Command(() => {
199
+ this.save();
200
+ }),
201
+ "exportDialog_Reset": new command.Command(() => {
202
+ this.reset();
203
+ })
204
+ };
205
+ binder.Binder.attachCommands(this.$element.find(".trv-export-dialog-layout"), this.optionsCommandSet, this.viewerOptions);
206
+ }
207
+ _attachEvents() {
208
+ this.controller.on("beginLoadReport", this.close.bind(this)).on("viewModeChanged", this.close.bind(this));
209
+ this.notificationService.setExportDialogVisible((event, args) => {
210
+ if (args && args.visible === true) {
211
+ this.open(args.format);
212
+ } else {
213
+ this.close();
214
+ }
215
+ });
216
+ $(window).on("resize", () => {
217
+ if (this.kendoExportDialog && this.kendoExportDialog.options.visible) {
218
+ if (!this.phoneViewport) {
219
+ this.storeDialogPosition();
220
+ }
221
+ this.updateDialogViewport();
222
+ this.adjustDialogPosition();
223
+ }
224
+ });
225
+ }
226
+ isPhoneViewport() {
227
+ return $(window).innerWidth() <= 767;
228
+ }
229
+ updateDialogViewport() {
230
+ const phone = this.isPhoneViewport();
231
+ if (phone !== this.phoneViewport) {
232
+ this.phoneViewport = phone;
233
+ this.kendoExportDialog.setOptions({ draggable: !phone });
234
+ }
235
+ this.updateFormatDrawerForViewport();
236
+ kendo.resize(this.$element, true);
237
+ }
238
+ open() {
239
+ this.dialogVisible = false;
240
+ const formatsPromise = this.controller.getDocumentFormats();
241
+ Promise.resolve(formatsPromise).then((formats) => {
242
+ if (!RCV.hasExportSettings(formats)) {
243
+ return;
244
+ }
245
+ this.dialogVisible = true;
246
+ this.pendingValues = {};
247
+ this.initialValues = {};
248
+ this.formats = formats || [];
249
+ this.buildFormatDrawer();
250
+ this.kendoExportDialog.open();
251
+ });
252
+ }
253
+ close() {
254
+ this.dialogVisible = false;
255
+ this.pendingValues = {};
256
+ this.initialValues = {};
257
+ this.destroySettingsForm();
258
+ if (this.kendoExportDialog && this.kendoExportDialog.options.visible) {
259
+ this.kendoExportDialog.close();
260
+ }
261
+ }
262
+ buildFormatDrawer() {
263
+ const selectedFormat = this.formats.some((item) => item.name === this.format) ? this.format : this.formats[0]?.name;
264
+ const drawerItems = this.formats.map((format) => ({
265
+ format: format.name,
266
+ text: format.localizedName,
267
+ selected: format.name === selectedFormat,
268
+ miniTemplate: () => {
269
+ const iconClass = utils.getRenderingExtensionIconClass(format.name);
270
+ const icon = iconClass ? `<span aria-hidden="true" class="k-sprite rendering-extension-icon ${iconClass}"></span>` : `<span aria-hidden="true">${kendo.htmlEncode(format.name.slice(0, 3))}</span>`;
271
+ return `<li data-role="drawer-item">${icon}</li>`;
272
+ }
273
+ }));
274
+ if (this.formatDrawer) {
275
+ this.formatDrawer.setOptions({ items: drawerItems });
276
+ } else {
277
+ this.formatDrawer = this.$formatSelector.kendoDrawer({
278
+ items: drawerItems,
279
+ mode: "push",
280
+ position: "left",
281
+ width: 240,
282
+ mini: { width: 48 },
283
+ expanded: !this.isPhoneViewport(),
284
+ autoCollapse: false,
285
+ swipeToOpen: false,
286
+ navigatable: true,
287
+ itemClick: (event) => {
288
+ if (event.dataItem?.format) {
289
+ this.showFormat(event.dataItem.format);
290
+ }
291
+ }
292
+ }).data("kendoDrawer");
293
+ }
294
+ this.updateFormatDrawerForViewport();
295
+ this.renderFormatDrawerIcons();
296
+ this.showFormat(selectedFormat);
297
+ }
298
+ updateFormatDrawerForViewport() {
299
+ if (!this.formatDrawer) {
300
+ return;
301
+ }
302
+ if (this.isPhoneViewport() && this.formatDrawer.visible) {
303
+ this.formatDrawer.hide();
304
+ } else if (!this.isPhoneViewport() && !this.formatDrawer.visible) {
305
+ this.formatDrawer.show();
306
+ }
307
+ if (this.formatDrawer.visible) {
308
+ this.renderFormatDrawerIcons();
309
+ }
310
+ }
311
+ renderFormatDrawerIcons() {
312
+ if (!this.formatDrawer.visible) {
313
+ return;
314
+ }
315
+ const drawerElements = this.formatDrawer.drawerItemsWrapper.find('[data-role="drawer-item"]');
316
+ drawerElements.each((index, element) => {
317
+ const format = this.formats[index];
318
+ const iconClass = utils.getRenderingExtensionIconClass(format?.name);
319
+ const $element = $(element);
320
+ $element.find(".k-item-text").attr("title", format?.localizedName || "");
321
+ if (iconClass && !$element.find(".rendering-extension-icon").length) {
322
+ $element.prepend(
323
+ $('<span aria-hidden="true"></span>').addClass(
324
+ `k-sprite rendering-extension-icon ${iconClass}`
325
+ )
326
+ );
327
+ }
328
+ });
329
+ }
330
+ showFormat(format) {
331
+ this.capturePendingValues();
332
+ this.format = format;
333
+ const extension = this.formats.find((item) => item.name === format);
334
+ this.$element.find(".trv-export-dialog-format-name").text(
335
+ `${extension?.localizedName || format || ""}${stringResources.stringResources.exportDialogSettingsSuffix}`
336
+ );
337
+ this.$element.find(".trv-export-dialog-reset").attr("title", stringResources.stringResources.ariaLabelExportDialogReset);
338
+ this.buildSettingsForm(extension ? extension.settings : []);
339
+ }
340
+ buildSettingsForm(settings) {
341
+ this.destroySettingsForm();
342
+ if (!settings || settings.length === 0) {
343
+ this.$noSettingsMessage.removeClass("k-hidden");
344
+ return;
345
+ }
346
+ this.$noSettingsMessage.addClass("k-hidden");
347
+ if (!kendo.ui.Form) {
348
+ console.error("The Kendo UI Form widget is not available. Export settings cannot be displayed.");
349
+ this.$noSettingsMessage.removeClass("k-hidden");
350
+ return;
351
+ }
352
+ const formData = {};
353
+ const groups = /* @__PURE__ */ new Map();
354
+ settings.forEach((setting) => {
355
+ const pendingValues = this.pendingValues[this.format];
356
+ const savedValue = this.exportSettingsStore ? this.exportSettingsStore.getValue(this.format, setting) : setting.value;
357
+ const initialValue = pendingValues && Object.prototype.hasOwnProperty.call(pendingValues, setting.name) ? pendingValues[setting.name] : savedValue ?? this.getDefaultValue(setting.type);
358
+ const groupName = setting.group?.trim() || "General";
359
+ const groupSettings = groups.get(groupName) || [];
360
+ formData[setting.name] = initialValue;
361
+ groupSettings.push(setting);
362
+ groups.set(groupName, groupSettings);
363
+ });
364
+ const pageRangeSelected = Number(formData.StartPage) > 0;
365
+ if (!Object.prototype.hasOwnProperty.call(this.initialValues, this.format)) {
366
+ this.initialValues[this.format] = { ...formData };
367
+ }
368
+ this.currentValues = { ...formData };
369
+ formData[PAGE_SELECTION_FIELD] = pageRangeSelected;
370
+ const formElement = $('<div class="trv-export-settings-form"></div>').appendTo(this.$settingsContainer.empty());
371
+ const items = Array.from(groups, ([name, groupSettings]) => {
372
+ const isPagingGroup = name === "Paging";
373
+ const groupItems = groupSettings.map((setting) => this.createFormItem(setting));
374
+ if (isPagingGroup) {
375
+ this.pagingSettingNames = groupSettings.map((setting) => setting.name);
376
+ groupItems.reverse();
377
+ groupItems.unshift(this.createPageSelectionFormItem(pageRangeSelected));
378
+ }
379
+ return {
380
+ type: "group",
381
+ label: name,
382
+ layout: "grid",
383
+ grid: { cols: 1, gutter: 12 },
384
+ items: groupItems
385
+ };
386
+ });
387
+ this.settingsForm = formElement.kendoForm({
388
+ formData: { ...formData },
389
+ items,
390
+ renderButtons: false,
391
+ focusFirst: false,
392
+ validatable: {
393
+ validateOnBlur: false,
394
+ validationSummary: false
395
+ },
396
+ change: (event) => {
397
+ if (event.field !== PAGE_SELECTION_FIELD) {
398
+ this.currentValues[event.field] = event.value;
399
+ }
400
+ }
401
+ }).data("kendoForm");
402
+ this.renderSettingInfoIcons(settings);
403
+ this.togglePagingSettings(pageRangeSelected);
404
+ }
405
+ renderSettingInfoIcons(settings) {
406
+ settings.forEach((setting) => {
407
+ if (!setting.description) {
408
+ return;
409
+ }
410
+ const label = this.$settingsContainer.find(".k-form-label").filter((index, element) => element.htmlFor === setting.name);
411
+ const info = $('<span class="trv-export-setting-info" tabindex="0" role="img"></span>').attr({
412
+ "aria-label": setting.description,
413
+ "data-description": setting.description
414
+ }).append(kendo.ui.icon({ icon: "info-circle", type: "font" })).on("click", (event) => event.preventDefault());
415
+ label.append(info);
416
+ });
417
+ }
418
+ createPageSelectionFormItem(pageRangeSelected) {
419
+ return {
420
+ field: PAGE_SELECTION_FIELD,
421
+ label: stringResources.stringResources.exportDialogPagesLabel,
422
+ editor: createPageSelectionEditor,
423
+ editorOptions: {
424
+ pageRangeSelected,
425
+ allPagesLabel: stringResources.stringResources.exportDialogAllPagesLabel,
426
+ pageRangeLabel: stringResources.stringResources.exportDialogPageRangeLabel,
427
+ change: (selected, model) => this.onPageSelectionChange(selected, model)
428
+ }
429
+ };
430
+ }
431
+ onPageSelectionChange(pageRangeSelected, model) {
432
+ model.set(PAGE_SELECTION_FIELD, pageRangeSelected);
433
+ if (pageRangeSelected) {
434
+ if (this.pagingSettingNames.includes("StartPage") && Number(model.get("StartPage")) <= 0) {
435
+ model.set("StartPage", 1);
436
+ }
437
+ } else {
438
+ if (this.pagingSettingNames.includes("StartPage")) {
439
+ model.set("StartPage", 0);
440
+ }
441
+ if (this.pagingSettingNames.includes("EndPage")) {
442
+ model.set("EndPage", 0);
443
+ }
444
+ }
445
+ this.togglePagingSettings(pageRangeSelected);
446
+ }
447
+ togglePagingSettings(pageRangeSelected) {
448
+ this.pagingSettingNames.forEach((name) => {
449
+ this.$settingsContainer.find(`[data-container-for="${name}"]`).closest(".k-form-field").toggleClass("k-hidden", !pageRangeSelected);
450
+ });
451
+ }
452
+ createFormItem(setting) {
453
+ const item = {
454
+ field: setting.name,
455
+ label: this.getSettingLabel(setting.name),
456
+ editorOptions: {
457
+ enabled: !setting.readOnly
458
+ }
459
+ };
460
+ if (isPasswordSetting(setting.name)) {
461
+ item.editor = createPasswordEditor;
462
+ } else if (Array.isArray(setting.availableValues) && setting.availableValues.length > 0) {
463
+ item.editor = createDropDownEditor;
464
+ item.editorOptions.dataSource = [...setting.availableValues];
465
+ } else {
466
+ switch (setting.type) {
467
+ case "boolean":
468
+ item.editor = createCheckBoxEditor;
469
+ break;
470
+ case "number":
471
+ item.editor = createNumericEditor;
472
+ break;
473
+ default:
474
+ item.editor = createTextEditor;
475
+ break;
476
+ }
477
+ }
478
+ return item;
479
+ }
480
+ capturePendingValues() {
481
+ if (this.currentValues && this.format) {
482
+ this.pendingValues[this.format] = { ...this.currentValues };
483
+ }
484
+ }
485
+ reset() {
486
+ if (!this.format || !this.exportSettingsStore?.resetValues(this.format)) {
487
+ return;
488
+ }
489
+ delete this.pendingValues[this.format];
490
+ delete this.initialValues[this.format];
491
+ const extension = this.formats.find((item) => item.name === this.format);
492
+ this.buildSettingsForm(extension ? extension.settings : []);
493
+ }
494
+ save() {
495
+ this.capturePendingValues();
496
+ let saved = true;
497
+ this.formats.forEach((extension) => {
498
+ const values = this.pendingValues[extension.name];
499
+ if (values && this.exportSettingsStore) {
500
+ const initialValues = this.initialValues[extension.name] || {};
501
+ const changedValues = {};
502
+ Object.keys(values).forEach((name) => {
503
+ if (values[name] !== initialValues[name]) {
504
+ changedValues[name] = values[name];
505
+ }
506
+ });
507
+ saved = this.exportSettingsStore.saveValues(
508
+ extension.name,
509
+ extension.settings || [],
510
+ changedValues
511
+ ) && saved;
512
+ if (saved) {
513
+ this.initialValues[extension.name] = { ...values };
514
+ }
515
+ }
516
+ });
517
+ if (saved) {
518
+ this.close();
519
+ }
520
+ }
521
+ getDefaultValue(settingType) {
522
+ switch (settingType) {
523
+ case "boolean":
524
+ return false;
525
+ case "number":
526
+ return null;
527
+ default:
528
+ return "";
529
+ }
530
+ }
531
+ getSettingLabel(name) {
532
+ return stringResources.stringResources["exportSetting_" + name] || RCV.splitPascalCase(name);
533
+ }
534
+ destroySettingsForm() {
535
+ if (this.settingsForm) {
536
+ this.settingsForm.destroy();
537
+ this.settingsForm = void 0;
538
+ }
539
+ this.currentValues = void 0;
540
+ this.pagingSettingNames = [];
541
+ if (this.$settingsContainer) {
542
+ this.$settingsContainer.empty();
543
+ }
544
+ }
545
+ storeDialogPosition() {
546
+ if (this.phoneViewport) {
547
+ return;
548
+ }
549
+ const kendoWindow = this.kendoExportDialog.element.parent(".k-window");
550
+ this.windowLocation = kendoWindow.offset();
551
+ }
552
+ adjustDialogPosition() {
553
+ if (this.phoneViewport) {
554
+ return;
555
+ }
556
+ const windowWidth = $(window).innerWidth();
557
+ const windowHeight = $(window).innerHeight();
558
+ const width = this.kendoExportDialog.wrapper.outerWidth(true);
559
+ const height = this.kendoExportDialog.wrapper.outerHeight(true);
560
+ const padding = 10;
561
+ if (!this.windowLocation) {
562
+ this.kendoExportDialog.center();
563
+ return;
564
+ }
565
+ let left = this.windowLocation.left;
566
+ let top = this.windowLocation.top;
567
+ const right = left + width;
568
+ const bottom = top + height;
569
+ if (right > windowWidth - padding) {
570
+ left = Math.max(padding, windowWidth - width - padding);
571
+ this.kendoExportDialog.setOptions({ position: { left } });
572
+ }
573
+ if (bottom > windowHeight - padding) {
574
+ top = Math.max(padding, windowHeight - height - padding);
575
+ this.kendoExportDialog.setOptions({ position: { top } });
576
+ }
577
+ }
578
+ // #endregion
579
+ }
580
+
581
+ exports.ExportDialog = ExportDialog;
@@ -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;
@@ -114,9 +114,16 @@ function MainMenu(element, options, viewerOptions) {
114
114
  $list.empty();
115
115
  Array.from(formats).forEach((format) => {
116
116
  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);
117
+ var iconClass = utils.getRenderingExtensionIconClass(format.name);
118
+ var icon = iconClass ? '<span aria-hidden="true" class="k-sprite rendering-extension-icon ' + iconClass + '"></span>' : "";
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 optionsIconClass = utils.getExportOptionsIconClass();
124
+ var optionsIcon = '<span aria-hidden="true" class="k-sprite rendering-extension-icon ' + optionsIconClass + '"></span>';
125
+ 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
+ }
120
127
  if (enableAccessibility) {
121
128
  setInternalListAccessibilityKeyEvents($parent.find("li"));
122
129
  }
@@ -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
  }