@progress/telerik-jquery-report-viewer 25.25.313 → 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.313.ttf → ReportingIcons-19.1.25.521.ttf} +0 -0
package/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
This package is part of [Telerik Reporting](https://www.telerik.com/reporting).
|
4
4
|
|
5
|
-
This version of Telerik jQuery Report Viewer requires Telerik Report Server or Telerik Reporting REST Service 19.
|
5
|
+
This version of Telerik jQuery Report Viewer requires Telerik Report Server or Telerik Reporting REST Service 19.1.25.521.
|
6
6
|
|
7
7
|
__Intended for internal purposes only.__
|
8
8
|
|
@@ -2,13 +2,11 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
|
6
|
-
var stringResources = require('./stringResources.js');
|
5
|
+
require('@progress/telerik-common-report-viewer');
|
7
6
|
|
8
7
|
var defaultOptions = {};
|
9
8
|
function Accessibility(options) {
|
10
9
|
var controller;
|
11
|
-
var pageInitialized = false;
|
12
10
|
var areas;
|
13
11
|
var lastArea;
|
14
12
|
var keyMap = {
|
@@ -27,25 +25,24 @@ function Accessibility(options) {
|
|
27
25
|
if (!controller) {
|
28
26
|
throw "No controller (telerikReporting.ReportViewerController) has been specified.";
|
29
27
|
}
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
});
|
28
|
+
init();
|
29
|
+
function init() {
|
30
|
+
_attachEvents();
|
31
|
+
}
|
32
|
+
function _attachEvents() {
|
33
|
+
controller.onAsync("reportLoadComplete", async () => {
|
34
|
+
setAccessibilityUI();
|
35
|
+
var content = findContentArea();
|
36
|
+
if (content.length > 0) {
|
37
|
+
content.focus();
|
38
|
+
}
|
39
|
+
}).on("pageReady", (event, page) => {
|
40
|
+
initPage(page);
|
41
|
+
}).on("error", (event, message) => {
|
42
|
+
focusOnErrorMessage();
|
43
|
+
window.setTimeout(setAccessibilityUI, 500);
|
44
|
+
});
|
45
|
+
}
|
49
46
|
function setAccessibilityUI() {
|
50
47
|
if (!areas) {
|
51
48
|
initAreas();
|
@@ -69,18 +66,6 @@ function Accessibility(options) {
|
|
69
66
|
var area = areas[keyMap.CONTENT_AREA_KEY];
|
70
67
|
setContentAreaKeyDown(area);
|
71
68
|
}
|
72
|
-
function setPageSelector() {
|
73
|
-
var pagers = document.querySelectorAll(".trv-report-pager");
|
74
|
-
var pageNumber = controller.getCurrentPageNumber();
|
75
|
-
var pageCount = controller.getPageCount();
|
76
|
-
pagers.forEach((pager) => {
|
77
|
-
pager.setAttribute("aria-label", utils.stringFormat(stringResources.stringResources.ariaLabelPageNumberSelector, [pageNumber, pageCount]));
|
78
|
-
var pageInputs = pager.querySelectorAll("input[data-role=telerik_ReportViewer_PageNumberInput]");
|
79
|
-
pageInputs.forEach((input) => {
|
80
|
-
input.setAttribute("aria-label", stringResources.stringResources.ariaLabelPageNumberEditor);
|
81
|
-
});
|
82
|
-
});
|
83
|
-
}
|
84
69
|
function initAreas() {
|
85
70
|
areas = {};
|
86
71
|
areas[keyMap.DOCUMENT_MAP_AREA_KEY] = findDocumentMapArea();
|
@@ -99,10 +84,10 @@ function Accessibility(options) {
|
|
99
84
|
return $("div[data-role=telerik_ReportViewer_DocumentMapArea] div[data-role=treeview]");
|
100
85
|
}
|
101
86
|
function findMenuArea() {
|
102
|
-
return $("
|
87
|
+
return $("div[data-role=telerik_ReportViewer_Toolbar]");
|
103
88
|
}
|
104
89
|
function findParametersArea() {
|
105
|
-
return $("div[data-role=telerik_ReportViewer_ParametersArea]
|
90
|
+
return $("div[data-role=telerik_ReportViewer_ParametersArea] .trv-parameters-area-content .trv-parameters-wrapper");
|
106
91
|
}
|
107
92
|
function processKeyDown(event) {
|
108
93
|
if (!areas) {
|
@@ -146,7 +131,7 @@ function Accessibility(options) {
|
|
146
131
|
});
|
147
132
|
}
|
148
133
|
function IsAreaContainerVisible(container) {
|
149
|
-
return container && !(container.hasClass("k-collapsed") || container.hasClass("
|
134
|
+
return container && !(container.hasClass("k-collapsed") || container.hasClass("k-hidden"));
|
150
135
|
}
|
151
136
|
function setContentAreaKeyDown(contentArea) {
|
152
137
|
if (!contentArea) {
|
@@ -165,33 +150,6 @@ function Accessibility(options) {
|
|
165
150
|
});
|
166
151
|
});
|
167
152
|
}
|
168
|
-
function decorateMenuItems() {
|
169
|
-
var menuAreas = areas[keyMap.MENU_AREA_KEY];
|
170
|
-
if (!menuAreas) {
|
171
|
-
return;
|
172
|
-
}
|
173
|
-
Array.from(menuAreas).forEach((menu) => {
|
174
|
-
var $menu = $(menu);
|
175
|
-
var menuItems = $menu.children("li.k-item");
|
176
|
-
Array.from(menuItems).forEach((menuItem) => {
|
177
|
-
var $menuItem = $(menuItem);
|
178
|
-
if (!$menuItem.hasClass("trv-report-pager")) {
|
179
|
-
var ariaLabel = $menuItem.attr("aria-label");
|
180
|
-
var expandableSr = utils.stringFormat(". {0}", [stringResources.stringResources.ariaLabelExpandable]);
|
181
|
-
var expandable = $menuItem.find("ul").length > 0 && ariaLabel.indexOf(expandableSr) < 0 ? expandableSr : "";
|
182
|
-
var selectedSr = utils.stringFormat(". {0}", [stringResources.stringResources.ariaLabelSelected]);
|
183
|
-
var selected = $menuItem.hasClass("k-selected") && ariaLabel.indexOf(selectedSr) < 0 ? selectedSr : "";
|
184
|
-
var label = ariaLabel + expandable + selected;
|
185
|
-
$menuItem.attr("aria-label", label);
|
186
|
-
if ($menuItem.hasClass("k-disabled")) {
|
187
|
-
$menuItem.attr("aria-disabled", "true");
|
188
|
-
} else {
|
189
|
-
$menuItem.removeAttr("aria-disabled");
|
190
|
-
}
|
191
|
-
}
|
192
|
-
});
|
193
|
-
});
|
194
|
-
}
|
195
153
|
function setKeyMap(keyMapValues) {
|
196
154
|
keyMap = keyMapValues;
|
197
155
|
areas = void 0;
|
@@ -0,0 +1,311 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var binder = require('./binder.js');
|
6
|
+
var command = require('./command.js');
|
7
|
+
var stringResources = require('./stringResources.js');
|
8
|
+
|
9
|
+
var defaultOptions = {};
|
10
|
+
function replaceStringResources($aiDialogsWrapper) {
|
11
|
+
if (!$aiDialogsWrapper) {
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
var labels = $aiDialogsWrapper.find(".trv-replace-string");
|
15
|
+
var ariaLabel = $aiDialogsWrapper.find("[aria-label]").add($aiDialogsWrapper);
|
16
|
+
var titles = $aiDialogsWrapper.find("[title]");
|
17
|
+
if (labels.length) {
|
18
|
+
Array.from(labels).forEach((element) => {
|
19
|
+
replaceText($(element));
|
20
|
+
});
|
21
|
+
}
|
22
|
+
if (ariaLabel.length) {
|
23
|
+
Array.from(ariaLabel).forEach((element) => {
|
24
|
+
replaceAttribute($(element), "aria-label");
|
25
|
+
});
|
26
|
+
}
|
27
|
+
if (titles.length) {
|
28
|
+
Array.from(titles).forEach((element) => {
|
29
|
+
replaceAttribute($(element), "title");
|
30
|
+
});
|
31
|
+
}
|
32
|
+
}
|
33
|
+
function replaceText($el) {
|
34
|
+
if ($el) {
|
35
|
+
$el.text(stringResources.stringResources[$el.text()]);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
function replaceAttribute($el, attribute) {
|
39
|
+
if ($el) {
|
40
|
+
$el.attr(attribute, stringResources.stringResources[$el.attr(attribute)]);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
class AiPrompt {
|
44
|
+
constructor(element, options, viewerOptions) {
|
45
|
+
this.options = $.extend({}, defaultOptions, options);
|
46
|
+
this.viewerOptions = viewerOptions;
|
47
|
+
this.controller = this.options.controller;
|
48
|
+
if (!this.controller) {
|
49
|
+
throw "No controller (telerikReporting.ReportViewerController) has been specified.";
|
50
|
+
}
|
51
|
+
this.notificationService = this.options.notificationService;
|
52
|
+
if (!this.notificationService) {
|
53
|
+
throw "No notificationService (telerikReporting.NotificationService) has been specified.";
|
54
|
+
}
|
55
|
+
this.element = element;
|
56
|
+
this.$element = $(element);
|
57
|
+
this.kendoAiConsentDialog;
|
58
|
+
this.kendoAiPromptDialog;
|
59
|
+
this.kendoAiPrompt;
|
60
|
+
this.kendoAiPromtDialogLocation;
|
61
|
+
this.pagesAreaContainer = $('[data-id="trv-pages-area"]');
|
62
|
+
this.aiPromptDialogInitialized = false;
|
63
|
+
this.aiPromptInitialized = false;
|
64
|
+
const aiConfigurationOptions = this.controller.getAiConfigurationOptions();
|
65
|
+
this.requireConsent = aiConfigurationOptions.requireConsent;
|
66
|
+
this.allowCustomPrompts = aiConfigurationOptions.allowCustomPrompts;
|
67
|
+
this.init();
|
68
|
+
}
|
69
|
+
init() {
|
70
|
+
if (this.aiPromptDialogInitialized) {
|
71
|
+
return;
|
72
|
+
}
|
73
|
+
replaceStringResources(this.$element);
|
74
|
+
if (this.requireConsent) {
|
75
|
+
this._initAiConsentDialog();
|
76
|
+
this._attachAiConsentDialogCommands();
|
77
|
+
}
|
78
|
+
this._initAiPromptDialog();
|
79
|
+
this._attachEvents();
|
80
|
+
this.aiPromptDialogInitialized = true;
|
81
|
+
}
|
82
|
+
_attachEvents() {
|
83
|
+
this.controller.on("beginLoadReport", this.close.bind(this)).on("viewModeChanged", this.close.bind(this));
|
84
|
+
this.notificationService.setAiPromptDialogVisible((event, args) => {
|
85
|
+
this.toggleAiPromptDialog(args.visible);
|
86
|
+
}).setSendEmailDialogVisible((event, args) => {
|
87
|
+
if (args.visible && this.controller.getAiPromptInitiated()) {
|
88
|
+
this.close();
|
89
|
+
}
|
90
|
+
});
|
91
|
+
$(window).on("resize", () => {
|
92
|
+
if (this.kendoAiPromptDialog && this.kendoAiPromptDialog.options.visible) {
|
93
|
+
this.storeDialogPosition();
|
94
|
+
this.adjustDialogPosition(this.kendoAiPromptDialog);
|
95
|
+
}
|
96
|
+
});
|
97
|
+
}
|
98
|
+
_attachAiConsentDialogCommands() {
|
99
|
+
const optionsCommandSet = {
|
100
|
+
"aiConsent_Cancel": new command.Command(() => {
|
101
|
+
this.kendoAiConsentDialog.close();
|
102
|
+
this.notificationService.setAiPromptDialogVisible({
|
103
|
+
visible: false
|
104
|
+
});
|
105
|
+
}),
|
106
|
+
"aiConsent_Accept": new command.Command(() => {
|
107
|
+
this.kendoAiConsentDialog.close();
|
108
|
+
this.controller.saveToSessionStorage("trvAiConsent", "true");
|
109
|
+
this.controller.setAiPromptInitiated(true);
|
110
|
+
this.open();
|
111
|
+
})
|
112
|
+
};
|
113
|
+
binder.Binder.attachCommands(this.kendoAiConsentDialog.element.find(".trv-ai-consent-actions"), optionsCommandSet, this.viewerOptions);
|
114
|
+
}
|
115
|
+
_initAiConsentDialog() {
|
116
|
+
const aiConsentDialogElement = this.element.querySelector(".trv-ai-consent-dialog");
|
117
|
+
if (!aiConsentDialogElement) {
|
118
|
+
console.warn('Failed to initialize AI consent dialog due to missing element with class "trv-ai-consent-dialog".');
|
119
|
+
return;
|
120
|
+
}
|
121
|
+
this.kendoAiConsentDialog = new kendo.ui.Window(aiConsentDialogElement, {
|
122
|
+
title: "Before you start with AI",
|
123
|
+
width: 500,
|
124
|
+
minWidth: 400,
|
125
|
+
minHeight: 106,
|
126
|
+
maxHeight: 800,
|
127
|
+
resizable: false,
|
128
|
+
scrollable: true,
|
129
|
+
open: (event) => {
|
130
|
+
this.adjustDialogPosition(this.kendoAiConsentDialog);
|
131
|
+
}
|
132
|
+
});
|
133
|
+
this.kendoAiConsentDialog.element.removeClass("trv-ai-consent-dialog k-hidden");
|
134
|
+
this.kendoAiConsentDialog.wrapper.addClass("trv-ai-consent-dialog");
|
135
|
+
}
|
136
|
+
_initAiPromptDialog() {
|
137
|
+
const aiPromptDialogElement = this.element.querySelector(".trv-ai-prompt-dialog");
|
138
|
+
if (!aiPromptDialogElement) {
|
139
|
+
console.warn('Failed to initialize AI prompt dialog due to missing element with class "trv-ai-prompt-dialog".');
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
this.kendoAiPromptDialog = new kendo.ui.Window(aiPromptDialogElement, {
|
143
|
+
title: false,
|
144
|
+
visible: false,
|
145
|
+
draggable: {
|
146
|
+
dragHandle: ".k-prompt-header"
|
147
|
+
},
|
148
|
+
height: "fit-content",
|
149
|
+
width: 500,
|
150
|
+
minWidth: 400,
|
151
|
+
maxHeight: 800,
|
152
|
+
scrollable: true,
|
153
|
+
close: (event) => {
|
154
|
+
this.storeDialogPosition();
|
155
|
+
},
|
156
|
+
open: (event) => {
|
157
|
+
this.adjustDialogPosition(this.kendoAiPromptDialog);
|
158
|
+
},
|
159
|
+
deactivate: (event) => {
|
160
|
+
this.notificationService.setAiPromptDialogVisible({
|
161
|
+
visible: false
|
162
|
+
});
|
163
|
+
}
|
164
|
+
});
|
165
|
+
this.kendoAiPromptDialog.element.removeClass("trv-ai-prompt-dialog k-hidden");
|
166
|
+
this.kendoAiPromptDialog.wrapper.addClass("trv-ai-prompt-dialog");
|
167
|
+
}
|
168
|
+
_initAiPrompt(promptSuggestions) {
|
169
|
+
if (this.aiPromptInitialized) {
|
170
|
+
return;
|
171
|
+
}
|
172
|
+
const aiPromptElement = this.kendoAiPromptDialog?.element?.find("#trv-ai-prompt");
|
173
|
+
if (!aiPromptElement) {
|
174
|
+
console.warn('Failed to initialize AI prompt dialog due to missing element with id "trv-ai-prompt".');
|
175
|
+
return;
|
176
|
+
}
|
177
|
+
const that = this;
|
178
|
+
this.kendoAiPrompt = new kendo.ui.AIPrompt(aiPromptElement, {
|
179
|
+
activeView: 0,
|
180
|
+
promptRequest: function(event) {
|
181
|
+
if (!event.prompt) {
|
182
|
+
return;
|
183
|
+
}
|
184
|
+
that.controller.getAIResponse(event.prompt).then((response) => {
|
185
|
+
this.addPromptOutput(that.createPromptOutputFromResponse(response, event));
|
186
|
+
this.activeView(1);
|
187
|
+
}).catch((error) => {
|
188
|
+
this.addPromptOutput(that.createPromptOutputFromResponse(error?._responseJSON, event));
|
189
|
+
this.activeView(1);
|
190
|
+
});
|
191
|
+
},
|
192
|
+
toolbarItems: [
|
193
|
+
{ type: "spacer" },
|
194
|
+
{ type: "button", icon: "x", fillMode: "flat", themeColor: "primary", click: (e) => {
|
195
|
+
this.close();
|
196
|
+
} }
|
197
|
+
],
|
198
|
+
views: [
|
199
|
+
{
|
200
|
+
type: "prompt",
|
201
|
+
promptSuggestions,
|
202
|
+
messages: {
|
203
|
+
promptPlaceholder: "Enter your prompt"
|
204
|
+
}
|
205
|
+
},
|
206
|
+
{
|
207
|
+
type: "output"
|
208
|
+
}
|
209
|
+
]
|
210
|
+
});
|
211
|
+
this.disableAiPromptTextArea(promptSuggestions && promptSuggestions.length > 0);
|
212
|
+
const aiPromptToolbar = this.kendoAiPrompt.element.find(".k-prompt-header .k-toolbar").data("kendoToolBar");
|
213
|
+
aiPromptToolbar && aiPromptToolbar.bind("toggle", (e) => {
|
214
|
+
if (e.target.text() === "Ask AI") {
|
215
|
+
this.disableAiPromptTextArea(promptSuggestions && promptSuggestions.length > 0);
|
216
|
+
}
|
217
|
+
});
|
218
|
+
this.aiPromptInitialized = true;
|
219
|
+
}
|
220
|
+
disableAiPromptTextArea(hasPromptSuggestions) {
|
221
|
+
if (this.allowCustomPrompts) {
|
222
|
+
return;
|
223
|
+
}
|
224
|
+
let aiPromptTextAreaPlaceholder = "Enter your prompt";
|
225
|
+
const aiPromptTextArea = this.kendoAiPrompt.element.find(".k-prompt-content .k-prompt-view textarea");
|
226
|
+
if (!hasPromptSuggestions) {
|
227
|
+
const aiPromptGenerateButton = this.kendoAiPrompt.element.find(".k-prompt-footer");
|
228
|
+
aiPromptGenerateButton && aiPromptGenerateButton.addClass("k-disabled");
|
229
|
+
aiPromptTextAreaPlaceholder = "Custom prompts are disabled and there are no predefined prompts configured. Please allow custom prompts or add predefined prompts to use the AI feature.";
|
230
|
+
} else {
|
231
|
+
aiPromptTextAreaPlaceholder = "Custom prompts are disabled, please select one of the predefined suggestions below";
|
232
|
+
}
|
233
|
+
aiPromptTextArea && aiPromptTextArea.attr("placeholder", aiPromptTextAreaPlaceholder) && aiPromptTextArea.addClass("k-disabled");
|
234
|
+
}
|
235
|
+
storeDialogPosition() {
|
236
|
+
this.kendoAiPromtDialogLocation = this.kendoAiPromptDialog.wrapper.offset();
|
237
|
+
}
|
238
|
+
adjustDialogPosition(dialog) {
|
239
|
+
var windowWidth = $(window).innerWidth();
|
240
|
+
var windowHeight = $(window).innerHeight();
|
241
|
+
var width = dialog.wrapper.outerWidth(true);
|
242
|
+
var height = dialog.wrapper.outerHeight(true);
|
243
|
+
var padding = 10;
|
244
|
+
if (!this.kendoAiPromtDialogLocation) {
|
245
|
+
var reportViewerCoords = this.pagesAreaContainer[0].getBoundingClientRect();
|
246
|
+
dialog.setOptions({
|
247
|
+
position: {
|
248
|
+
top: reportViewerCoords.top + padding,
|
249
|
+
left: reportViewerCoords.right - width - padding
|
250
|
+
}
|
251
|
+
});
|
252
|
+
} else {
|
253
|
+
var left = this.kendoAiPromtDialogLocation.left;
|
254
|
+
var top = this.kendoAiPromtDialogLocation.top;
|
255
|
+
var right = left + width;
|
256
|
+
var bottom = top + height;
|
257
|
+
if (right > windowWidth - padding) {
|
258
|
+
left = Math.max(padding, windowWidth - width - padding);
|
259
|
+
dialog.setOptions({
|
260
|
+
position: {
|
261
|
+
left
|
262
|
+
}
|
263
|
+
});
|
264
|
+
}
|
265
|
+
if (bottom > windowHeight - padding) {
|
266
|
+
top = Math.max(padding, windowHeight - height - padding);
|
267
|
+
this.kendoAiPromptDialog.setOptions({
|
268
|
+
position: {
|
269
|
+
top
|
270
|
+
}
|
271
|
+
});
|
272
|
+
}
|
273
|
+
}
|
274
|
+
}
|
275
|
+
toggleAiPromptDialog(show) {
|
276
|
+
if (show) {
|
277
|
+
this.open();
|
278
|
+
} else {
|
279
|
+
this.close();
|
280
|
+
}
|
281
|
+
}
|
282
|
+
open() {
|
283
|
+
if (this.kendoAiConsentDialog && this.requireConsent && this.controller.loadFromSessionStorage("trvAiConsent") !== "true") {
|
284
|
+
this.kendoAiConsentDialog.open();
|
285
|
+
return;
|
286
|
+
}
|
287
|
+
if (this.kendoAiPromptDialog) {
|
288
|
+
this.controller.createAIThread().then((data) => {
|
289
|
+
this.controller.setAiPromptInitiated(true);
|
290
|
+
this._initAiPrompt(data?.predefinedPrompts);
|
291
|
+
this.kendoAiPromptDialog.open();
|
292
|
+
});
|
293
|
+
}
|
294
|
+
}
|
295
|
+
close() {
|
296
|
+
this.controller.setAiPromptInitiated(false);
|
297
|
+
if (this.kendoAiPromptDialog && this.kendoAiPromptDialog.options.visible) {
|
298
|
+
this.kendoAiPromptDialog.close();
|
299
|
+
}
|
300
|
+
}
|
301
|
+
createPromptOutputFromResponse(response, promptData) {
|
302
|
+
return {
|
303
|
+
id: kendo.guid(),
|
304
|
+
output: response,
|
305
|
+
prompt: promptData.prompt,
|
306
|
+
isRetry: promptData.isRetry
|
307
|
+
};
|
308
|
+
}
|
309
|
+
}
|
310
|
+
|
311
|
+
exports.AiPrompt = AiPrompt;
|
@@ -2,23 +2,20 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var __defProp = Object.defineProperty;
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
7
|
-
var __publicField = (obj, key, value) => {
|
8
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
9
|
-
return value;
|
10
|
-
};
|
11
5
|
class BaseComponent {
|
6
|
+
// #region fields
|
7
|
+
element;
|
8
|
+
$element;
|
9
|
+
options;
|
12
10
|
// #endregion
|
13
11
|
// #region constructor
|
14
|
-
constructor(element, options) {
|
15
|
-
// #region fields
|
16
|
-
__publicField(this, "element");
|
17
|
-
__publicField(this, "$element");
|
18
|
-
__publicField(this, "options");
|
12
|
+
constructor(element, options = {}) {
|
19
13
|
this.element = element;
|
20
14
|
this.$element = $(element);
|
21
15
|
this.options = options;
|
16
|
+
Object.defineProperty(this.element, "__COMPONENT__", {
|
17
|
+
get: () => this
|
18
|
+
});
|
22
19
|
}
|
23
20
|
// #endregion
|
24
21
|
}
|
package/dist/cjs/binder.js
CHANGED
@@ -30,26 +30,26 @@ class Binder {
|
|
30
30
|
attachCommand(key, command, viewerOptions, $element);
|
31
31
|
});
|
32
32
|
function commandHandler(event) {
|
33
|
-
var prefixedDataCommand = $(
|
33
|
+
var prefixedDataCommand = $(event.currentTarget).attr("data-command");
|
34
34
|
if (prefixedDataCommand) {
|
35
35
|
var dataCommand = prefixedDataCommand.substring("telerik_ReportViewer_".length);
|
36
36
|
var cmd = commands[dataCommand];
|
37
|
-
if (cmd && cmd.
|
38
|
-
cmd.exec($(
|
37
|
+
if (cmd && cmd.getEnabled()) {
|
38
|
+
cmd.exec($(event.currentTarget).attr("data-command-parameter"));
|
39
39
|
}
|
40
40
|
event.preventDefault();
|
41
41
|
}
|
42
42
|
}
|
43
43
|
function customCommandHandler(event) {
|
44
|
-
var $this = $(
|
44
|
+
var $this = $(event.currentTarget);
|
45
45
|
var prefixedDataCommand = $this.attr("data-command");
|
46
46
|
var reportViewerTarget = $this.attr("data-target-report-viewer");
|
47
47
|
if (prefixedDataCommand && reportViewerTarget) {
|
48
48
|
var dataCommand = prefixedDataCommand.substring("telerik_ReportViewer_".length);
|
49
49
|
var reportViewer = $(reportViewerTarget).data("telerik_ReportViewer");
|
50
50
|
var cmd = reportViewer.commands[dataCommand];
|
51
|
-
if (cmd.
|
52
|
-
cmd.exec($(
|
51
|
+
if (cmd.getEnabled()) {
|
52
|
+
cmd.exec($(event.currentTarget).attr("data-command-parameter"));
|
53
53
|
}
|
54
54
|
event.preventDefault();
|
55
55
|
}
|
@@ -62,13 +62,13 @@ function attachCommand(dataCommand, cmd, viewerOptions, $element) {
|
|
62
62
|
var customElementSelector = '[data-target-report-viewer="' + viewerOptions.selector + '"]' + elementSelector;
|
63
63
|
var $defaultElement = $element.find(elementSelector);
|
64
64
|
var $customElement = $(customElementSelector);
|
65
|
-
$(cmd).on("enabledChanged",
|
66
|
-
(cmd.
|
67
|
-
(cmd.
|
68
|
-
}).on("checkedChanged",
|
65
|
+
$(cmd).on("enabledChanged", (event) => {
|
66
|
+
(cmd.getEnabled() ? $.fn.removeClass : $.fn.addClass).call($defaultElement.parent("li"), "k-disabled");
|
67
|
+
(cmd.getEnabled() ? $.fn.removeClass : $.fn.addClass).call($customElement, viewerOptions.disabledButtonClass);
|
68
|
+
}).on("checkedChanged", (event) => {
|
69
69
|
var defaultTarget = $defaultElement.parent("li");
|
70
|
-
(cmd.
|
71
|
-
(cmd.
|
70
|
+
(cmd.getChecked() ? $.fn.addClass : $.fn.removeClass).call(defaultTarget, getSelectedClassName(defaultTarget));
|
71
|
+
(cmd.getChecked() ? $.fn.addClass : $.fn.removeClass).call($customElement, viewerOptions.checkedButtonClass);
|
72
72
|
});
|
73
73
|
}
|
74
74
|
}
|
package/dist/cjs/command.js
CHANGED
@@ -2,31 +2,50 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
5
|
+
class Command {
|
6
|
+
// #region fields
|
7
|
+
_enabled;
|
8
|
+
_checked;
|
9
|
+
_fn;
|
10
|
+
// #endregion
|
11
|
+
// #region properties
|
12
|
+
getEnabled() {
|
13
|
+
return this._enabled;
|
14
|
+
}
|
15
|
+
setEnabled(value) {
|
16
|
+
const newState = Boolean(value);
|
17
|
+
if (this._enabled !== newState) {
|
18
|
+
this._enabled = newState;
|
19
|
+
}
|
20
|
+
$(this).trigger("enabledChanged", this._enabled);
|
21
|
+
return this;
|
22
|
+
}
|
23
|
+
getChecked() {
|
24
|
+
return this._checked;
|
25
|
+
}
|
26
|
+
setChecked(value) {
|
27
|
+
const newState = Boolean(value);
|
28
|
+
if (this._checked !== newState) {
|
29
|
+
this._checked = newState;
|
30
|
+
}
|
31
|
+
$(this).trigger("checkedChanged", this._checked);
|
32
|
+
return this;
|
33
|
+
}
|
34
|
+
// #endregion
|
35
|
+
// #region constructor
|
36
|
+
constructor(fn) {
|
37
|
+
this._enabled = true;
|
38
|
+
this._checked = false;
|
39
|
+
this._fn = fn;
|
40
|
+
}
|
41
|
+
// #endregion
|
42
|
+
// #region methods
|
43
|
+
exec(...args) {
|
44
|
+
if (typeof this._fn === "function") {
|
45
|
+
this._fn.apply(this, args);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
// #endregion
|
30
49
|
}
|
31
50
|
|
32
51
|
exports.Command = Command;
|