@progress/telerik-jquery-report-viewer 21.24.130 → 22.24.514

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/accessibility.js +218 -0
  3. package/dist/cjs/binder.js +172 -0
  4. package/dist/cjs/command.js +32 -0
  5. package/dist/cjs/commandSet.js +167 -0
  6. package/dist/cjs/controller.js +1207 -0
  7. package/dist/cjs/documentMapArea.js +168 -0
  8. package/dist/cjs/domUtils.js +50 -0
  9. package/dist/cjs/enums.js +52 -0
  10. package/dist/cjs/event-emitter.js +17 -0
  11. package/dist/cjs/events.js +23 -0
  12. package/dist/cjs/globalSettings.js +9 -0
  13. package/dist/cjs/history.js +131 -0
  14. package/dist/cjs/index.js +58 -0
  15. package/dist/cjs/jqueryThrottleDebounce.js +48 -0
  16. package/dist/cjs/kendo-jquery.js +4 -0
  17. package/dist/cjs/mainMenu.js +332 -0
  18. package/dist/cjs/mem-storage.js +44 -0
  19. package/dist/cjs/pagesArea.js +641 -0
  20. package/dist/cjs/parameterValidators.js +167 -0
  21. package/dist/cjs/parameters.js +921 -0
  22. package/dist/cjs/parametersArea.js +502 -0
  23. package/dist/cjs/perspectives.js +138 -0
  24. package/dist/cjs/print.js +166 -0
  25. package/dist/cjs/report-viewer/report-viewer-settings.js +138 -0
  26. package/dist/cjs/reportViewer.js +654 -0
  27. package/dist/cjs/scroll.js +537 -0
  28. package/dist/cjs/search.js +634 -0
  29. package/dist/cjs/sendEmail.js +435 -0
  30. package/dist/cjs/service-client-sentinel.js +52 -0
  31. package/dist/cjs/serviceClient.js +405 -0
  32. package/dist/cjs/sideMenu.js +225 -0
  33. package/dist/cjs/sr.js +164 -0
  34. package/dist/cjs/stringResources.js +11 -0
  35. package/dist/cjs/telerikReportViewer.kendo.js +60196 -0
  36. package/dist/cjs/telerikReportViewer.kendo.min.js +19776 -0
  37. package/dist/cjs/template-cache.js +39 -0
  38. package/dist/cjs/touch.js +86 -0
  39. package/dist/cjs/uiController.js +142 -0
  40. package/dist/cjs/uiFreezeCoordinator.js +281 -0
  41. package/dist/cjs/utils.js +492 -0
  42. package/dist/es/accessibility.js +214 -0
  43. package/dist/es/binder.js +168 -0
  44. package/dist/es/command.js +28 -0
  45. package/dist/es/commandSet.js +163 -0
  46. package/dist/es/controller.js +1203 -0
  47. package/dist/es/documentMapArea.js +164 -0
  48. package/dist/es/domUtils.js +43 -0
  49. package/dist/es/enums.js +41 -0
  50. package/dist/es/event-emitter.js +13 -0
  51. package/dist/es/events.js +19 -0
  52. package/dist/es/globalSettings.js +5 -0
  53. package/dist/es/history.js +127 -0
  54. package/dist/es/index.js +24 -0
  55. package/dist/es/jqueryThrottleDebounce.js +46 -0
  56. package/dist/es/kendo-jquery.js +1 -0
  57. package/dist/es/mainMenu.js +328 -0
  58. package/dist/es/mem-storage.js +40 -0
  59. package/dist/es/pagesArea.js +637 -0
  60. package/dist/es/parameterValidators.js +163 -0
  61. package/dist/es/parameters.js +916 -0
  62. package/dist/es/parametersArea.js +498 -0
  63. package/dist/es/perspectives.js +134 -0
  64. package/dist/es/print.js +162 -0
  65. package/dist/es/report-viewer/report-viewer-settings.js +134 -0
  66. package/dist/es/reportViewer.js +650 -0
  67. package/dist/es/scroll.js +533 -0
  68. package/dist/es/search.js +630 -0
  69. package/dist/es/sendEmail.js +431 -0
  70. package/dist/es/service-client-sentinel.js +48 -0
  71. package/dist/es/serviceClient.js +401 -0
  72. package/dist/es/sideMenu.js +221 -0
  73. package/dist/es/sr.js +162 -0
  74. package/dist/es/stringResources.js +7 -0
  75. package/dist/es/telerikReportViewer.kendo.js +60194 -0
  76. package/dist/es/telerikReportViewer.kendo.min.js +19774 -0
  77. package/dist/es/template-cache.js +35 -0
  78. package/dist/es/touch.js +82 -0
  79. package/dist/es/uiController.js +138 -0
  80. package/dist/es/uiFreezeCoordinator.js +277 -0
  81. package/dist/es/utils.js +447 -0
  82. package/dist/font/font-icons.css +4 -4
  83. package/dist/font/font-icons.min.css +3 -3
  84. package/dist/js/telerikReportViewer.js +8574 -8249
  85. package/dist/js/telerikReportViewer.min.js +1 -17
  86. package/dist/js/telerikReportViewer.stringResources.js +166 -173
  87. package/dist/styles/telerikReportViewer.css +1 -1
  88. package/dist/styles/telerikReportViewer.min.css +1 -1
  89. package/dist/templates/telerikReportViewerTemplate-FA.html +3 -3
  90. package/dist/templates/telerikReportViewerTemplate.html +3 -3
  91. package/package.json +13 -7
  92. /package/dist/font/{ReportingIcons-18.0.24.130.ttf → ReportingIcons-18.1.24.514.ttf} +0 -0
@@ -0,0 +1,431 @@
1
+ import { each } from './utils.js';
2
+ import { stringResources } from './stringResources.js';
3
+ import { Binder } from './binder.js';
4
+
5
+ var defaultOptions = {};
6
+ function SendEmail(placeholder, options, viewerOptions) {
7
+ options = $.extend({}, defaultOptions, options);
8
+ var controller = options.controller;
9
+ var initialized = false;
10
+ var dialogVisible = false;
11
+ var $placeholder;
12
+ var kendoSendEmailDialog;
13
+ var selector = viewerOptions.viewerSelector;
14
+ var inputFrom;
15
+ var inputTo;
16
+ var inputCC;
17
+ var inputSubject;
18
+ var docFormat;
19
+ var docFormatEl;
20
+ var bodyEditorEl;
21
+ var bodyEditor;
22
+ var docFormatList;
23
+ var optionsCommandSet;
24
+ var windowLocation;
25
+ var reportViewerWrapper = $("[data-selector='" + selector + "']").find(".trv-report-viewer");
26
+ if (!controller) {
27
+ throw "No controller (telerikReporting.ReportViewerController) has been specified.";
28
+ }
29
+ if (!viewerOptions.sendEmail || !viewerOptions.sendEmail.enabled) {
30
+ var toolbarSendEmailItem = $("[data-selector='" + selector + "']").find("a[data-command='telerik_ReportViewer_toggleSendEmailDialog']").closest(".k-item ");
31
+ toolbarSendEmailItem.hide();
32
+ return;
33
+ }
34
+ controller.beginLoadReport(closeAndClear).viewModeChanged(closeAndClear);
35
+ controller.getSendEmailDialogState(function(event, args) {
36
+ args.visible = dialogVisible;
37
+ }).setSendEmailDialogVisible(function(event, args) {
38
+ toggle(args.visible);
39
+ }).setSearchDialogVisible(function(event, args) {
40
+ if (args.visible && dialogVisible) {
41
+ toggle(!dialogVisible);
42
+ }
43
+ });
44
+ controller.getDocumentFormats().then(function(formats) {
45
+ docFormatList = formats;
46
+ });
47
+ function closeAndClear() {
48
+ toggle(false);
49
+ }
50
+ function toggle(show) {
51
+ dialogVisible = show;
52
+ if (show) {
53
+ ensureInitialized();
54
+ setDefaultValues(viewerOptions.sendEmail);
55
+ kendoSendEmailDialog.open();
56
+ } else {
57
+ if (kendoSendEmailDialog && kendoSendEmailDialog.options.visible) {
58
+ kendoSendEmailDialog.close();
59
+ }
60
+ }
61
+ }
62
+ function getBody() {
63
+ return bodyEditor ? bodyEditor.value() : "";
64
+ }
65
+ function ensureInitialized() {
66
+ if (!initialized) {
67
+ $placeholder = $(placeholder);
68
+ inputFrom = $placeholder.find("[name='from']");
69
+ inputTo = $placeholder.find("[name='to']");
70
+ inputCC = $placeholder.find("[name='cc']");
71
+ inputSubject = $placeholder.find("[name='subject']");
72
+ docFormatEl = $placeholder.find("[name='format']");
73
+ bodyEditorEl = $placeholder.find("textarea");
74
+ setAttrs();
75
+ initCommands();
76
+ replaceStringResources($placeholder);
77
+ try {
78
+ kendoSendEmailDialog = reportViewerWrapper.find(".trv-send-email-window").kendoWindow({
79
+ title: stringResources.sendEmailDialogTitle,
80
+ minWidth: 350,
81
+ minHeight: 350,
82
+ maxHeight: 900,
83
+ modal: true,
84
+ close: function() {
85
+ storeDialogPosition();
86
+ clearValidation();
87
+ },
88
+ open: function() {
89
+ adjustDialogSize();
90
+ adjustDialogPosition();
91
+ },
92
+ deactivate: function() {
93
+ controller.setSendEmailDialogVisible({
94
+ visible: false
95
+ });
96
+ },
97
+ activate: function() {
98
+ kendoSendEmailDialog.wrapper.find(".trv-send-email-fields input[type='email']:visible").first().focus();
99
+ setTimeout(function() {
100
+ setValidation();
101
+ }, 250);
102
+ }
103
+ }).data("kendoWindow");
104
+ } catch (e) {
105
+ console.error("Instantiation of Kendo Window for Send Email dialog threw an exception", e);
106
+ throw e;
107
+ }
108
+ kendoSendEmailDialog.wrapper.addClass("trv-send-email");
109
+ try {
110
+ docFormat = docFormatEl.kendoComboBox({
111
+ dataTextField: "localizedName",
112
+ dataValueField: "name",
113
+ dataSource: docFormatList || [],
114
+ filter: "startswith",
115
+ dataBound: function() {
116
+ this.select(0);
117
+ this.trigger("change");
118
+ }
119
+ }).data("kendoComboBox");
120
+ } catch (e) {
121
+ console.error("Instantiation of Kendo ComboBox as document format selector threw an exception", e);
122
+ throw e;
123
+ }
124
+ $placeholder.on("keydown", '[name="format_input"]', function(e) {
125
+ var tabkey = 9;
126
+ if (e.keyCode === tabkey && bodyEditor) {
127
+ setTimeout(function() {
128
+ bodyEditor.focus();
129
+ });
130
+ }
131
+ });
132
+ try {
133
+ bodyEditor = bodyEditorEl.kendoEditor({
134
+ tools: [
135
+ "bold",
136
+ "italic",
137
+ "underline",
138
+ "strikethrough",
139
+ "justifyLeft",
140
+ "justifyCenter",
141
+ "justifyRight",
142
+ "justifyFull",
143
+ "insertUnorderedList",
144
+ "insertOrderedList",
145
+ "indent",
146
+ "outdent",
147
+ "createLink",
148
+ "unlink",
149
+ "cleanFormatting",
150
+ "formatting",
151
+ "fontName",
152
+ "fontSize",
153
+ "foreColor",
154
+ "backColor",
155
+ "subscript",
156
+ "superscript"
157
+ ]
158
+ }).data("kendoEditor");
159
+ } catch (e) {
160
+ console.error("Instantiation of Kendo Editor for Email body editor threw an exception", e);
161
+ throw e;
162
+ }
163
+ setDefaultValues(viewerOptions.sendEmail);
164
+ initialized = true;
165
+ }
166
+ }
167
+ $(window).resize(function() {
168
+ if (kendoSendEmailDialog && kendoSendEmailDialog.options.visible) {
169
+ storeDialogPosition();
170
+ adjustDialogSize();
171
+ adjustDialogPosition();
172
+ }
173
+ });
174
+ function setAttrs() {
175
+ $placeholder.find(".trv-send-email-field input").each(function() {
176
+ var el = $(this);
177
+ var attrName = el.attr("name");
178
+ el.attr("id", selector + "-" + attrName);
179
+ });
180
+ $placeholder.find(".trv-send-email-label label").each(function() {
181
+ var el = $(this);
182
+ var attrName = el.attr("for");
183
+ el.attr("for", selector + "-" + attrName);
184
+ });
185
+ }
186
+ function storeDialogPosition() {
187
+ var kendoWindow = kendoSendEmailDialog.element.parent(".k-window");
188
+ windowLocation = kendoWindow.offset();
189
+ }
190
+ function adjustDialogSize() {
191
+ var kendoWindow = kendoSendEmailDialog.element.parent(".k-window");
192
+ var windowWidth = $(window).width();
193
+ var kendoWindowWidth = 350;
194
+ if (windowWidth > 800) {
195
+ kendoWindowWidth = 720;
196
+ }
197
+ kendoWindow.css({ width: kendoWindowWidth });
198
+ kendoSendEmailDialog.refresh({
199
+ width: kendoWindowWidth
200
+ });
201
+ }
202
+ function adjustDialogPosition() {
203
+ if (!windowLocation) {
204
+ kendoSendEmailDialog.center();
205
+ } else {
206
+ var padding = 10;
207
+ var windowWidth = $(window).innerWidth();
208
+ var windowHeight = $(window).innerHeight();
209
+ var kendoWindow = kendoSendEmailDialog.wrapper;
210
+ var width = kendoWindow.outerWidth(true);
211
+ var height = kendoWindow.outerHeight(true);
212
+ var left = windowLocation.left;
213
+ var top = windowLocation.top;
214
+ var right = left + width;
215
+ var bottom = top + height;
216
+ if (right > windowWidth - padding) {
217
+ left = Math.max(padding, windowWidth - width - padding);
218
+ kendoWindow.css({ left });
219
+ kendoSendEmailDialog.setOptions({
220
+ position: {
221
+ left
222
+ }
223
+ });
224
+ }
225
+ if (bottom > windowHeight - padding) {
226
+ top = Math.max(padding, windowHeight - height - padding);
227
+ kendoWindow.css({ top });
228
+ kendoSendEmailDialog.setOptions({
229
+ position: {
230
+ top
231
+ }
232
+ });
233
+ }
234
+ }
235
+ }
236
+ function initCommands() {
237
+ optionsCommandSet = {
238
+ //the command names MUST match the commands in the template.html with the "telerik_Reportviewer" prefix so the binder could work.
239
+ "sendEmail_Cancel": new command(function() {
240
+ closeWindow();
241
+ }),
242
+ "sendEmail_Send": new command(function(e) {
243
+ sendingEmail();
244
+ })
245
+ };
246
+ Binder.bind(
247
+ $placeholder.find(".trv-send-email-actions"),
248
+ {
249
+ controller,
250
+ commands: optionsCommandSet
251
+ },
252
+ viewerOptions
253
+ );
254
+ }
255
+ function sendingEmail(cmd, args) {
256
+ var sendEmailArgs = {
257
+ from: inputFrom.val(),
258
+ to: inputTo.val(),
259
+ cc: inputCC.val(),
260
+ subject: inputSubject.val(),
261
+ format: docFormat.value(),
262
+ body: getBody(),
263
+ deviceInfo: {}
264
+ };
265
+ if (validateFields()) {
266
+ controller.sendReport(sendEmailArgs);
267
+ closeWindow();
268
+ }
269
+ }
270
+ function setValidation() {
271
+ inputFrom.off("blur").on("blur", function(e) {
272
+ if (!isEmpty($(this))) {
273
+ isValidEmail($(this), false);
274
+ }
275
+ });
276
+ inputTo.off("blur").on("blur", function(e) {
277
+ if (!isEmpty($(this))) {
278
+ isValidEmail($(this), true);
279
+ }
280
+ });
281
+ inputCC.off("blur").on("blur", function(e) {
282
+ if ($(this).val().length) {
283
+ isValidEmail($(this), true);
284
+ } else {
285
+ hideError($(this));
286
+ }
287
+ });
288
+ }
289
+ function validateFields() {
290
+ var fromIsValid = isEmpty(inputFrom) || !isValidEmail(inputFrom, false);
291
+ var toIsValid = isEmpty(inputTo) || !isValidEmail(inputTo, true);
292
+ var ccIsValid = inputCC.val().length && !isValidEmail(inputCC, true);
293
+ var hasFormat = docFormat.value().length;
294
+ if (!hasFormat) {
295
+ showError(docFormatEl, "data-required-msg");
296
+ }
297
+ if (fromIsValid || toIsValid || ccIsValid || !hasFormat) {
298
+ return false;
299
+ }
300
+ return true;
301
+ }
302
+ function setDefaultValues(sendEmail) {
303
+ inputFrom.val(sendEmail && sendEmail.from || "");
304
+ inputTo.val(sendEmail && sendEmail.to || "");
305
+ inputCC.val(sendEmail && sendEmail.cc || "");
306
+ inputSubject.val(sendEmail && sendEmail.subject || "");
307
+ if (sendEmail && sendEmail.format) {
308
+ docFormat.value(sendEmail.format);
309
+ } else {
310
+ docFormat.select(0);
311
+ }
312
+ docFormat.trigger("change");
313
+ bodyEditor.value(sendEmail && sendEmail.body || "");
314
+ }
315
+ function isEmpty($el) {
316
+ if (!$el.val().length) {
317
+ showError($el, "data-required-msg");
318
+ return true;
319
+ }
320
+ hideError($el);
321
+ return false;
322
+ }
323
+ function showError($el, tag) {
324
+ var validationMsg = stringResources[$el.attr(tag)];
325
+ $('[data-for="' + $el.attr("name") + '"]').addClass("-visible").text(validationMsg);
326
+ }
327
+ function hideError($el) {
328
+ $('[data-for="' + $el.attr("name") + '"]').removeClass("-visible");
329
+ }
330
+ function isValidEmail($el, moreThenOneEmail) {
331
+ var inputValue = $el.val();
332
+ if (moreThenOneEmail) {
333
+ var listEmailsAddress = inputValue.split(/[\s,;]+/);
334
+ for (var i = 0; i < listEmailsAddress.length; i++) {
335
+ if (!_validateEmail(listEmailsAddress[i].trim(), $el)) {
336
+ return false;
337
+ }
338
+ }
339
+ return true;
340
+ } else {
341
+ return _validateEmail(inputValue, $el);
342
+ }
343
+ }
344
+ function _validateEmail(email, $el) {
345
+ var regexEmail = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
346
+ if (email.indexOf(",") > -1 || email.indexOf(";") > -1) {
347
+ showError($el, "data-single-email-msg");
348
+ return false;
349
+ }
350
+ if (!regexEmail.test(email)) {
351
+ showError($el, "data-email-msg");
352
+ return false;
353
+ }
354
+ return true;
355
+ }
356
+ function closeWindow() {
357
+ kendoSendEmailDialog.close();
358
+ }
359
+ function clearValidation() {
360
+ $(".k-invalid-msg").removeClass("-visible");
361
+ }
362
+ function replaceStringResources($sendEmailDialog) {
363
+ if (!$sendEmailDialog) {
364
+ return;
365
+ }
366
+ var labels = $sendEmailDialog.find(".trv-replace-string");
367
+ var ariaLabel = $sendEmailDialog.find("[aria-label]");
368
+ var titles = $sendEmailDialog.find("[title]");
369
+ if (labels.length) {
370
+ $.each(labels, function(key, value) {
371
+ replaceText($(value));
372
+ });
373
+ }
374
+ if (ariaLabel.length) {
375
+ $.each(ariaLabel, function(key, value) {
376
+ replaceAttribute($(value), "aria-label");
377
+ });
378
+ }
379
+ if (titles.length) {
380
+ $.each(titles, function(key, value) {
381
+ replaceAttribute($(value), "title");
382
+ });
383
+ }
384
+ }
385
+ function replaceText($el) {
386
+ if ($el) {
387
+ $el.text(stringResources[$el.text()]);
388
+ }
389
+ }
390
+ function replaceAttribute($el, attribute) {
391
+ if ($el) {
392
+ $el.attr(attribute, stringResources[$el.attr(attribute)]);
393
+ }
394
+ }
395
+ function command(execCallback) {
396
+ var enabledState = true;
397
+ var checkedState = false;
398
+ var cmd = {
399
+ enabled: function(state) {
400
+ if (arguments.length === 0) {
401
+ return enabledState;
402
+ }
403
+ var newState = Boolean(state);
404
+ enabledState = newState;
405
+ $(this).trigger("enabledChanged");
406
+ return cmd;
407
+ },
408
+ checked: function(state) {
409
+ if (arguments.length === 0) {
410
+ return checkedState;
411
+ }
412
+ var newState = Boolean(state);
413
+ checkedState = newState;
414
+ $(this).trigger("checkedChanged");
415
+ return cmd;
416
+ },
417
+ exec: execCallback
418
+ };
419
+ return cmd;
420
+ }
421
+ }
422
+ var pluginName = "telerik_ReportViewer_SendEmail";
423
+ $.fn[pluginName] = function(options, viewerOptions) {
424
+ return each(this, function() {
425
+ if (!$.data(this, pluginName)) {
426
+ $.data(this, pluginName, new SendEmail(this, options, viewerOptions));
427
+ }
428
+ });
429
+ };
430
+
431
+ export { SendEmail };
@@ -0,0 +1,48 @@
1
+ import { stringResources } from './stringResources.js';
2
+
3
+ function isNumber(value) {
4
+ return typeof value === "number" && isFinite(value);
5
+ }
6
+ function secondsToMilliseconds(seconds) {
7
+ return seconds * 1e3;
8
+ }
9
+ function ServiceClientSentinel(serviceClient, clientID, sessionTimeoutSeconds) {
10
+ if (!serviceClient) {
11
+ throw stringResources.noServiceClient;
12
+ }
13
+ if (!isNumber(sessionTimeoutSeconds)) {
14
+ throw "sessionTimeoutSeconds must a number and must be finite";
15
+ }
16
+ var interval;
17
+ var pingMilliseconds;
18
+ if (sessionTimeoutSeconds <= 120) {
19
+ pingMilliseconds = secondsToMilliseconds(sessionTimeoutSeconds) / 2;
20
+ } else {
21
+ pingMilliseconds = secondsToMilliseconds(sessionTimeoutSeconds - 60);
22
+ }
23
+ function start() {
24
+ if (pingMilliseconds <= 0) {
25
+ return;
26
+ }
27
+ interval = setInterval(function() {
28
+ serviceClient.keepClientAlive(clientID);
29
+ }, pingMilliseconds);
30
+ }
31
+ function restart() {
32
+ stop();
33
+ start();
34
+ }
35
+ function stop() {
36
+ if (interval) {
37
+ clearInterval(interval);
38
+ interval = null;
39
+ }
40
+ }
41
+ return {
42
+ start,
43
+ restart,
44
+ stop
45
+ };
46
+ }
47
+
48
+ export { ServiceClientSentinel };