@progress/telerik-jquery-report-viewer 21.24.130 → 22.24.514
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 +218 -0
- package/dist/cjs/binder.js +172 -0
- package/dist/cjs/command.js +32 -0
- package/dist/cjs/commandSet.js +167 -0
- package/dist/cjs/controller.js +1207 -0
- package/dist/cjs/documentMapArea.js +168 -0
- package/dist/cjs/domUtils.js +50 -0
- package/dist/cjs/enums.js +52 -0
- package/dist/cjs/event-emitter.js +17 -0
- package/dist/cjs/events.js +23 -0
- package/dist/cjs/globalSettings.js +9 -0
- package/dist/cjs/history.js +131 -0
- package/dist/cjs/index.js +58 -0
- package/dist/cjs/jqueryThrottleDebounce.js +48 -0
- package/dist/cjs/kendo-jquery.js +4 -0
- package/dist/cjs/mainMenu.js +332 -0
- package/dist/cjs/mem-storage.js +44 -0
- package/dist/cjs/pagesArea.js +641 -0
- package/dist/cjs/parameterValidators.js +167 -0
- package/dist/cjs/parameters.js +921 -0
- package/dist/cjs/parametersArea.js +502 -0
- package/dist/cjs/perspectives.js +138 -0
- package/dist/cjs/print.js +166 -0
- package/dist/cjs/report-viewer/report-viewer-settings.js +138 -0
- package/dist/cjs/reportViewer.js +654 -0
- package/dist/cjs/scroll.js +537 -0
- package/dist/cjs/search.js +634 -0
- package/dist/cjs/sendEmail.js +435 -0
- package/dist/cjs/service-client-sentinel.js +52 -0
- package/dist/cjs/serviceClient.js +405 -0
- package/dist/cjs/sideMenu.js +225 -0
- package/dist/cjs/sr.js +164 -0
- package/dist/cjs/stringResources.js +11 -0
- package/dist/cjs/telerikReportViewer.kendo.js +60196 -0
- package/dist/cjs/telerikReportViewer.kendo.min.js +19776 -0
- package/dist/cjs/template-cache.js +39 -0
- package/dist/cjs/touch.js +86 -0
- package/dist/cjs/uiController.js +142 -0
- package/dist/cjs/uiFreezeCoordinator.js +281 -0
- package/dist/cjs/utils.js +492 -0
- package/dist/es/accessibility.js +214 -0
- package/dist/es/binder.js +168 -0
- package/dist/es/command.js +28 -0
- package/dist/es/commandSet.js +163 -0
- package/dist/es/controller.js +1203 -0
- package/dist/es/documentMapArea.js +164 -0
- package/dist/es/domUtils.js +43 -0
- package/dist/es/enums.js +41 -0
- package/dist/es/event-emitter.js +13 -0
- package/dist/es/events.js +19 -0
- package/dist/es/globalSettings.js +5 -0
- package/dist/es/history.js +127 -0
- package/dist/es/index.js +24 -0
- package/dist/es/jqueryThrottleDebounce.js +46 -0
- package/dist/es/kendo-jquery.js +1 -0
- package/dist/es/mainMenu.js +328 -0
- package/dist/es/mem-storage.js +40 -0
- package/dist/es/pagesArea.js +637 -0
- package/dist/es/parameterValidators.js +163 -0
- package/dist/es/parameters.js +916 -0
- package/dist/es/parametersArea.js +498 -0
- package/dist/es/perspectives.js +134 -0
- package/dist/es/print.js +162 -0
- package/dist/es/report-viewer/report-viewer-settings.js +134 -0
- package/dist/es/reportViewer.js +650 -0
- package/dist/es/scroll.js +533 -0
- package/dist/es/search.js +630 -0
- package/dist/es/sendEmail.js +431 -0
- package/dist/es/service-client-sentinel.js +48 -0
- package/dist/es/serviceClient.js +401 -0
- package/dist/es/sideMenu.js +221 -0
- package/dist/es/sr.js +162 -0
- package/dist/es/stringResources.js +7 -0
- package/dist/es/telerikReportViewer.kendo.js +60194 -0
- package/dist/es/telerikReportViewer.kendo.min.js +19774 -0
- package/dist/es/template-cache.js +35 -0
- package/dist/es/touch.js +82 -0
- package/dist/es/uiController.js +138 -0
- package/dist/es/uiFreezeCoordinator.js +277 -0
- package/dist/es/utils.js +447 -0
- package/dist/font/font-icons.css +4 -4
- package/dist/font/font-icons.min.css +3 -3
- package/dist/js/telerikReportViewer.js +8574 -8249
- package/dist/js/telerikReportViewer.min.js +1 -17
- package/dist/js/telerikReportViewer.stringResources.js +166 -173
- package/dist/styles/telerikReportViewer.css +1 -1
- package/dist/styles/telerikReportViewer.min.css +1 -1
- package/dist/templates/telerikReportViewerTemplate-FA.html +3 -3
- package/dist/templates/telerikReportViewerTemplate.html +3 -3
- package/package.json +13 -7
- /package/dist/font/{ReportingIcons-18.0.24.130.ttf → ReportingIcons-18.1.24.514.ttf} +0 -0
@@ -0,0 +1,921 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var utils = require('./utils.js');
|
6
|
+
var stringResources = require('./stringResources.js');
|
7
|
+
var enums = require('./enums.js');
|
8
|
+
|
9
|
+
var parameterEditorsMatch = {
|
10
|
+
// AvailableValues PROVIDED, MultiValue is TRUE and trv.parameters.editors.multiSelect is unset
|
11
|
+
MultiSelect: function(parameter, editorsType) {
|
12
|
+
return Boolean(parameter.availableValues) && parameter.multivalue && (!editorsType || !editorsType.multiSelect || editorsType.multiSelect !== enums.ParameterEditorTypes.COMBO_BOX);
|
13
|
+
},
|
14
|
+
// AvailableValues PROVIDED, MultiValue is TRUE and trv.parameters.editors.multiSelect is set to COMBO_BOX
|
15
|
+
MultiSelectCombo: function(parameter, editorsType) {
|
16
|
+
return Boolean(parameter.availableValues) && parameter.multivalue && (editorsType && editorsType.multiSelect && editorsType.multiSelect === enums.ParameterEditorTypes.COMBO_BOX);
|
17
|
+
},
|
18
|
+
// AvailableValues PROVIDED, MultiValue is FALSE and trv.parameters.editors.singleSelect is unset
|
19
|
+
SingleSelect: function(parameter, editorsType) {
|
20
|
+
return Boolean(parameter.availableValues) && !parameter.multivalue && (!editorsType || !editorsType.singleSelect || editorsType.singleSelect !== enums.ParameterEditorTypes.COMBO_BOX);
|
21
|
+
},
|
22
|
+
// AvailableValues PROVIDED, MultiValue is FALSE and trv.parameters.editors.singleSelect is set to COMBO_BOX
|
23
|
+
SingleSelectCombo: function(parameter, editorsType) {
|
24
|
+
return Boolean(parameter.availableValues) && !parameter.multivalue && (editorsType && editorsType.singleSelect && editorsType.singleSelect === enums.ParameterEditorTypes.COMBO_BOX);
|
25
|
+
},
|
26
|
+
// AvailableValues NOT PROVIDED and MultiValue is TRUE
|
27
|
+
MultiValue: function(parameter) {
|
28
|
+
return Boolean(parameter.multivalue);
|
29
|
+
},
|
30
|
+
DateTime: function(parameter) {
|
31
|
+
return parameter.type === enums.ParameterTypes.DATETIME;
|
32
|
+
},
|
33
|
+
String: function(parameter) {
|
34
|
+
return parameter.type === enums.ParameterTypes.STRING;
|
35
|
+
},
|
36
|
+
Number: function(parameter) {
|
37
|
+
switch (parameter.type) {
|
38
|
+
case enums.ParameterTypes.INTEGER:
|
39
|
+
case enums.ParameterTypes.FLOAT:
|
40
|
+
return true;
|
41
|
+
default:
|
42
|
+
return false;
|
43
|
+
}
|
44
|
+
},
|
45
|
+
Boolean: function(parameter) {
|
46
|
+
return parameter.type === enums.ParameterTypes.BOOLEAN;
|
47
|
+
},
|
48
|
+
Default: function(parameter) {
|
49
|
+
return true;
|
50
|
+
}
|
51
|
+
};
|
52
|
+
var multivalueUtils = function() {
|
53
|
+
var lineSeparator = "\n";
|
54
|
+
return {
|
55
|
+
formatValue: function(value) {
|
56
|
+
var text = "";
|
57
|
+
if (value) {
|
58
|
+
[].concat(value).forEach(function(val) {
|
59
|
+
if (text.length > 0) {
|
60
|
+
text += lineSeparator;
|
61
|
+
}
|
62
|
+
text += val;
|
63
|
+
});
|
64
|
+
}
|
65
|
+
return text;
|
66
|
+
},
|
67
|
+
parseValues: function(text) {
|
68
|
+
return ("" + text).split(lineSeparator);
|
69
|
+
}
|
70
|
+
};
|
71
|
+
}();
|
72
|
+
function integerInputBehavior(input) {
|
73
|
+
function isValid(newValue) {
|
74
|
+
return /^(\-|\+)?([0-9]*)$/.test(newValue);
|
75
|
+
}
|
76
|
+
function onKeyPress(event) {
|
77
|
+
if (utils.isSpecialKey(event.keyCode)) {
|
78
|
+
return true;
|
79
|
+
}
|
80
|
+
return isValid($(input).val() + String.fromCharCode(event.charCode));
|
81
|
+
}
|
82
|
+
function onPaste(event) {
|
83
|
+
}
|
84
|
+
function attach(input2) {
|
85
|
+
$(input2).on("keypress", onKeyPress).on("paste", onPaste);
|
86
|
+
}
|
87
|
+
function detach(input2) {
|
88
|
+
$(input2).off("keypress", onKeyPress).off("paste", onPaste);
|
89
|
+
}
|
90
|
+
attach(input);
|
91
|
+
return {
|
92
|
+
dispose: function() {
|
93
|
+
detach(input);
|
94
|
+
}
|
95
|
+
};
|
96
|
+
}
|
97
|
+
function floatInputBehavior(input) {
|
98
|
+
function isValid(newValue) {
|
99
|
+
return /^(\-|\+)?([0-9]*(\.[0-9]*)?)$/.test(newValue);
|
100
|
+
}
|
101
|
+
function onKeyPress(event) {
|
102
|
+
if (utils.isSpecialKey(event.keyCode)) {
|
103
|
+
return true;
|
104
|
+
}
|
105
|
+
return isValid($(input).val() + String.fromCharCode(event.charCode));
|
106
|
+
}
|
107
|
+
function onPaste(event) {
|
108
|
+
}
|
109
|
+
function attach(input2) {
|
110
|
+
$(input2).on("keypress", onKeyPress).on("paste", onPaste);
|
111
|
+
}
|
112
|
+
function detach(input2) {
|
113
|
+
$(input2).off("keypress", onKeyPress).off("paste", onPaste);
|
114
|
+
}
|
115
|
+
attach(input);
|
116
|
+
return {
|
117
|
+
dispose: function() {
|
118
|
+
detach(input);
|
119
|
+
}
|
120
|
+
};
|
121
|
+
}
|
122
|
+
function applyClass(apply, cssClass, item) {
|
123
|
+
var fn = apply ? $.fn.addClass : $.fn.removeClass;
|
124
|
+
fn.call(item, cssClass);
|
125
|
+
}
|
126
|
+
function enableItem(item, enable) {
|
127
|
+
applyClass(!enable, "k-disabled", item);
|
128
|
+
}
|
129
|
+
function selectItem(item, select) {
|
130
|
+
applyClass(select, "k-selected", item);
|
131
|
+
item.attr("aria-selected", select);
|
132
|
+
}
|
133
|
+
function addAccessibilityAttributes(editor, type, caption, additionalInfo, error) {
|
134
|
+
if (!additionalInfo) {
|
135
|
+
additionalInfo = "";
|
136
|
+
}
|
137
|
+
var label = utils.stringFormat("{0}. {1} {2}. {3}", [caption, type, stringResources.stringResources.ariaLabelParameter, additionalInfo]);
|
138
|
+
editor.attr("aria-label", label);
|
139
|
+
setAccessibilityErrorAttributes(editor, error);
|
140
|
+
}
|
141
|
+
var containerTabIndex;
|
142
|
+
var editorsIndex = 0;
|
143
|
+
function setEditorTabIndex(editor) {
|
144
|
+
if (!containerTabIndex) {
|
145
|
+
var $container = $("div.trv-parameters-area-content");
|
146
|
+
if ($container.length > 0) {
|
147
|
+
var tabIndexAttr = $container.attr("tabIndex");
|
148
|
+
if (tabIndexAttr) {
|
149
|
+
containerTabIndex = utils.tryParseInt(tabIndexAttr);
|
150
|
+
}
|
151
|
+
}
|
152
|
+
if (!containerTabIndex || isNaN(containerTabIndex)) {
|
153
|
+
containerTabIndex = 300;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
var wrapper = editor.closest(".trv-parameter-value");
|
157
|
+
var selectAll = wrapper.find(".trv-select-all");
|
158
|
+
var clearSelection = wrapper.find(".trv-select-none");
|
159
|
+
var widgetParent = editor.closest(".k-widget");
|
160
|
+
var hasFocusableElement = widgetParent.find(".k-input");
|
161
|
+
var isComboWidget = hasFocusableElement && hasFocusableElement.length;
|
162
|
+
if (selectAll && selectAll.length) {
|
163
|
+
selectAll.attr("tabindex", containerTabIndex + ++editorsIndex);
|
164
|
+
}
|
165
|
+
if (clearSelection && clearSelection.length) {
|
166
|
+
clearSelection.attr("tabindex", containerTabIndex + ++editorsIndex);
|
167
|
+
}
|
168
|
+
if (isComboWidget) {
|
169
|
+
hasFocusableElement.attr("tabindex", containerTabIndex + ++editorsIndex);
|
170
|
+
} else {
|
171
|
+
editor.attr("tabindex", containerTabIndex + ++editorsIndex);
|
172
|
+
}
|
173
|
+
}
|
174
|
+
function setAccessibilityErrorAttributes(editor, error) {
|
175
|
+
var errToken = utils.stringFormat(" {0}:", [stringResources.stringResources.ariaLabelErrorMessage]);
|
176
|
+
var label = editor.attr("aria-label");
|
177
|
+
if (!label) {
|
178
|
+
return;
|
179
|
+
}
|
180
|
+
var errIdx = label.indexOf(errToken);
|
181
|
+
if (errIdx > -1) {
|
182
|
+
label = label.substring(0, errIdx);
|
183
|
+
}
|
184
|
+
if (error && error !== "") {
|
185
|
+
editor.attr("aria-required", true);
|
186
|
+
editor.attr("aria-invalid", true);
|
187
|
+
label += errToken + error;
|
188
|
+
} else {
|
189
|
+
editor.removeAttr("aria-invalid");
|
190
|
+
}
|
191
|
+
editor.attr("aria-label", label);
|
192
|
+
}
|
193
|
+
function navigatableEnabledForList(enableAccessibility) {
|
194
|
+
return kendo.version >= "2017.3.1018" || enableAccessibility;
|
195
|
+
}
|
196
|
+
var ParameterEditors = [
|
197
|
+
{
|
198
|
+
match: parameterEditorsMatch.MultiSelect,
|
199
|
+
createEditor: function(placeholder, options) {
|
200
|
+
var $placeholder = $(placeholder);
|
201
|
+
var enabled = true;
|
202
|
+
$placeholder.html(options.templates["trv-parameter-editor-available-values-multiselect"]);
|
203
|
+
var $list = $placeholder.find(".trv-list");
|
204
|
+
var $selectAll = $placeholder.find(".trv-select-all");
|
205
|
+
var $selectNone = $placeholder.find(".trv-select-none");
|
206
|
+
var listView;
|
207
|
+
var parameter;
|
208
|
+
var updateTimeout;
|
209
|
+
var valueChangeCallback = options.parameterChanged;
|
210
|
+
var initialized;
|
211
|
+
$selectAll.text(stringResources.stringResources[$selectAll.text()]);
|
212
|
+
$selectAll.click(function(e) {
|
213
|
+
e.preventDefault();
|
214
|
+
if (!enabled)
|
215
|
+
return;
|
216
|
+
setSelectedItems(parameter.availableValues.map(function(av) {
|
217
|
+
return av.value;
|
218
|
+
}));
|
219
|
+
});
|
220
|
+
$selectNone.text(stringResources.stringResources[$selectNone.text()]);
|
221
|
+
$selectNone.click(function(e) {
|
222
|
+
e.preventDefault();
|
223
|
+
if (!enabled)
|
224
|
+
return;
|
225
|
+
setSelectedItems([]);
|
226
|
+
});
|
227
|
+
function onSelectionChanged(selection) {
|
228
|
+
if (initialized) {
|
229
|
+
applyAriaSelected(selection);
|
230
|
+
notifyParameterChanged(selection);
|
231
|
+
}
|
232
|
+
}
|
233
|
+
function applyAriaSelected(selection) {
|
234
|
+
var children = $list.find(".trv-listviewitem");
|
235
|
+
utils.each(children, function() {
|
236
|
+
var $item = $(this);
|
237
|
+
var isSelected = selection.filter($item).length > 0;
|
238
|
+
$item.attr("aria-selected", isSelected);
|
239
|
+
});
|
240
|
+
}
|
241
|
+
function notifyParameterChanged(selection) {
|
242
|
+
var availableValues = parameter.availableValues;
|
243
|
+
var values = $.map(selection, function(item) {
|
244
|
+
return availableValues[$(item).index()].value;
|
245
|
+
});
|
246
|
+
clearPendingChange();
|
247
|
+
var immediateUpdate = !parameter.autoRefresh && !parameter.childParameters;
|
248
|
+
updateTimeout = window.setTimeout(
|
249
|
+
function() {
|
250
|
+
if (!utils.areEqualArrays(parameter.value, values)) {
|
251
|
+
valueChangeCallback(parameter, values);
|
252
|
+
}
|
253
|
+
updateTimeout = null;
|
254
|
+
},
|
255
|
+
immediateUpdate ? 0 : 1e3
|
256
|
+
);
|
257
|
+
}
|
258
|
+
function clearPendingChange() {
|
259
|
+
if (updateTimeout) {
|
260
|
+
window.clearTimeout(updateTimeout);
|
261
|
+
}
|
262
|
+
}
|
263
|
+
function getSelectedItems() {
|
264
|
+
return $(listView.element).find(".k-selected");
|
265
|
+
}
|
266
|
+
function onItemClick(e) {
|
267
|
+
if (!enabled)
|
268
|
+
return;
|
269
|
+
var clickedItem = $(e.target);
|
270
|
+
var selectedItems = listView.select();
|
271
|
+
if (clickedItem.hasClass("k-selected")) {
|
272
|
+
selectedItems.splice($.inArray(clickedItem[0], selectedItems), 1);
|
273
|
+
} else {
|
274
|
+
selectedItems.push(clickedItem);
|
275
|
+
}
|
276
|
+
listView.clearSelection();
|
277
|
+
listView.select(selectedItems);
|
278
|
+
listView.trigger("change");
|
279
|
+
}
|
280
|
+
function onChange(e) {
|
281
|
+
onSelectionChanged(getSelectedItems());
|
282
|
+
}
|
283
|
+
function onKeydown(event) {
|
284
|
+
if (!enabled)
|
285
|
+
return;
|
286
|
+
if (event.which !== 32) {
|
287
|
+
return;
|
288
|
+
}
|
289
|
+
var focused = listView.element.find(".k-focus");
|
290
|
+
if (focused.length > 0) {
|
291
|
+
focused.toggleClass("k-selected");
|
292
|
+
onSelectionChanged(getSelectedItems());
|
293
|
+
event.preventDefault();
|
294
|
+
}
|
295
|
+
}
|
296
|
+
function init() {
|
297
|
+
setEditorTabIndex($list);
|
298
|
+
setSelectedItems(parameter.value);
|
299
|
+
listView.element.off().on("touch click", ".trv-listviewitem", onItemClick);
|
300
|
+
listView.element.on("keydown", onKeydown);
|
301
|
+
initialized = true;
|
302
|
+
}
|
303
|
+
function clear() {
|
304
|
+
initialized = false;
|
305
|
+
if (listView) {
|
306
|
+
listView.element.off("touch click", ".trv-listviewitem", onItemClick);
|
307
|
+
listView.element.off("keydown", onKeydown);
|
308
|
+
}
|
309
|
+
}
|
310
|
+
function setSelectedItems(items) {
|
311
|
+
setSelectedItemsCore(items);
|
312
|
+
onSelectionChanged(getSelectedItems());
|
313
|
+
}
|
314
|
+
function setSelectedItemsCore(items) {
|
315
|
+
if (!Array.isArray(items)) {
|
316
|
+
items = [items];
|
317
|
+
}
|
318
|
+
var children = $list.find(".trv-listviewitem");
|
319
|
+
utils.each(parameter.availableValues, function(i, av) {
|
320
|
+
var selected = false;
|
321
|
+
utils.each(items, function(j, v) {
|
322
|
+
var availableValue = av.value;
|
323
|
+
if (v instanceof Date) {
|
324
|
+
availableValue = utils.parseToLocalDate(av.value);
|
325
|
+
}
|
326
|
+
selected = utils.areEqual(v, availableValue);
|
327
|
+
return !selected;
|
328
|
+
});
|
329
|
+
selectItem($(children[i]), selected);
|
330
|
+
});
|
331
|
+
}
|
332
|
+
return {
|
333
|
+
beginEdit: function(param) {
|
334
|
+
clear();
|
335
|
+
parameter = param;
|
336
|
+
try {
|
337
|
+
listView = $list.kendoListView({
|
338
|
+
template: kendo.template('<div class="trv-listviewitem" style="cursor: pointer">${name}</div>'),
|
339
|
+
dataSource: { data: parameter.availableValues },
|
340
|
+
selectable: "MULTIPLE",
|
341
|
+
navigatable: navigatableEnabledForList(options.enableAccessibility),
|
342
|
+
change: onChange
|
343
|
+
}).data("kendoListView");
|
344
|
+
} catch (e) {
|
345
|
+
console.error("Instantiation of Kendo ListView as MultiSelect parameter editor threw an exception", e);
|
346
|
+
throw e;
|
347
|
+
}
|
348
|
+
init();
|
349
|
+
},
|
350
|
+
enable: function(enable) {
|
351
|
+
enabled = enable;
|
352
|
+
enableItem($list, enabled);
|
353
|
+
},
|
354
|
+
clearPendingChange,
|
355
|
+
addAccessibility: function(param) {
|
356
|
+
var info = utils.stringFormat(stringResources.stringResources.ariaLabelParameterInfo, [param.availableValues.length]);
|
357
|
+
addAccessibilityAttributes($list, stringResources.stringResources.ariaLabelMultiSelect, param.text, info, param.Error);
|
358
|
+
$list.attr("aria-multiselectable", "true");
|
359
|
+
var items = $list.find(".trv-listviewitem");
|
360
|
+
utils.each(items, function() {
|
361
|
+
$(this).attr("aria-label", this.innerText);
|
362
|
+
});
|
363
|
+
},
|
364
|
+
setAccessibilityErrorState: function(param) {
|
365
|
+
setAccessibilityErrorAttributes($list, param.Error);
|
366
|
+
},
|
367
|
+
destroy: function() {
|
368
|
+
listView.destroy();
|
369
|
+
}
|
370
|
+
};
|
371
|
+
}
|
372
|
+
},
|
373
|
+
{
|
374
|
+
match: parameterEditorsMatch.MultiSelectCombo,
|
375
|
+
createEditor: function(placeholder, options) {
|
376
|
+
var $placeholder = $(placeholder);
|
377
|
+
var enabled = true;
|
378
|
+
var selector = ".trv-combo";
|
379
|
+
var template = "trv-parameter-editor-available-values-multiselect-combo";
|
380
|
+
var valueChangeCallback = options.parameterChanged;
|
381
|
+
var $editorDom;
|
382
|
+
var $selectNone;
|
383
|
+
var $selectAll;
|
384
|
+
var editor;
|
385
|
+
var updateTimeout;
|
386
|
+
var popUpIsClosed = true;
|
387
|
+
var parameter;
|
388
|
+
$placeholder.html(options.templates[template]);
|
389
|
+
$editorDom = $placeholder.find(selector);
|
390
|
+
$selectNone = $placeholder.find(".trv-select-none");
|
391
|
+
if ($selectNone) {
|
392
|
+
$selectNone.text(stringResources.stringResources[$selectNone.text()]);
|
393
|
+
$selectNone.click(function(e) {
|
394
|
+
e.preventDefault();
|
395
|
+
editor.value([]);
|
396
|
+
editor.trigger("change");
|
397
|
+
});
|
398
|
+
}
|
399
|
+
$selectAll = $placeholder.find(".trv-select-all");
|
400
|
+
if ($selectAll) {
|
401
|
+
$selectAll.text(stringResources.stringResources[$selectAll.text()]);
|
402
|
+
$selectAll.click(function(e) {
|
403
|
+
e.preventDefault();
|
404
|
+
if (!enabled)
|
405
|
+
return;
|
406
|
+
var values = $.map(parameter.availableValues, function(dataItem) {
|
407
|
+
return dataItem.value;
|
408
|
+
});
|
409
|
+
editor.value(values);
|
410
|
+
editor.trigger("change");
|
411
|
+
});
|
412
|
+
}
|
413
|
+
function onSelectionChanged(selection) {
|
414
|
+
notifyParameterChanged(selection);
|
415
|
+
}
|
416
|
+
function notifyParameterChanged(values) {
|
417
|
+
clearPendingChange();
|
418
|
+
var immediateUpdate = !parameter.autoRefresh && !parameter.childParameters;
|
419
|
+
updateTimeout = window.setTimeout(
|
420
|
+
function() {
|
421
|
+
if (!utils.areEqualArrays(parameter.value, values)) {
|
422
|
+
valueChangeCallback(parameter, values);
|
423
|
+
}
|
424
|
+
updateTimeout = null;
|
425
|
+
},
|
426
|
+
immediateUpdate ? 0 : 1e3
|
427
|
+
);
|
428
|
+
}
|
429
|
+
function clearPendingChange() {
|
430
|
+
if (updateTimeout) {
|
431
|
+
window.clearTimeout(updateTimeout);
|
432
|
+
}
|
433
|
+
}
|
434
|
+
function getSelectedItems() {
|
435
|
+
return editor.value();
|
436
|
+
}
|
437
|
+
function onChange() {
|
438
|
+
if (popUpIsClosed) {
|
439
|
+
onSelectionChanged(getSelectedItems());
|
440
|
+
}
|
441
|
+
}
|
442
|
+
function init() {
|
443
|
+
setEditorTabIndex($editorDom);
|
444
|
+
editor.bind("change", onChange);
|
445
|
+
}
|
446
|
+
function reset() {
|
447
|
+
if (editor) {
|
448
|
+
editor.unbind("change", onChange);
|
449
|
+
}
|
450
|
+
}
|
451
|
+
return {
|
452
|
+
beginEdit: function(param) {
|
453
|
+
reset();
|
454
|
+
parameter = param;
|
455
|
+
try {
|
456
|
+
editor = $editorDom.kendoMultiSelect({
|
457
|
+
itemTemplate: '<div class="trv-editoritem">${name}</div>',
|
458
|
+
dataSource: parameter.availableValues,
|
459
|
+
dataTextField: "name",
|
460
|
+
dataValueField: "value",
|
461
|
+
value: parameter.value,
|
462
|
+
filter: "contains",
|
463
|
+
autoClose: false,
|
464
|
+
open: function() {
|
465
|
+
popUpIsClosed = false;
|
466
|
+
},
|
467
|
+
close: function(e) {
|
468
|
+
popUpIsClosed = true;
|
469
|
+
onChange();
|
470
|
+
},
|
471
|
+
autoWidth: true,
|
472
|
+
clearButton: false
|
473
|
+
}).data("kendoMultiSelect");
|
474
|
+
} catch (e) {
|
475
|
+
console.error("Instantiation of Kendo MultiSelect as MultiSelectCombo parameter editor threw an exception", e);
|
476
|
+
throw e;
|
477
|
+
}
|
478
|
+
init();
|
479
|
+
},
|
480
|
+
enable: function(enable) {
|
481
|
+
enabled = enable;
|
482
|
+
editor.enable(enable);
|
483
|
+
},
|
484
|
+
clearPendingChange,
|
485
|
+
addAccessibility: function(param) {
|
486
|
+
var $accessibilityDom = editor.input;
|
487
|
+
var info = utils.stringFormat(stringResources.stringResources.ariaLabelParameterInfo, [param.availableValues.length]);
|
488
|
+
addAccessibilityAttributes($accessibilityDom, stringResources.stringResources.ariaLabelMultiSelect, param.text, info, param.Error);
|
489
|
+
var items = editor.items();
|
490
|
+
utils.each(items, function() {
|
491
|
+
$(this).attr("aria-label", this.innerText);
|
492
|
+
});
|
493
|
+
},
|
494
|
+
setAccessibilityErrorState: function(param) {
|
495
|
+
setAccessibilityErrorAttributes($editorDom, param.Error);
|
496
|
+
},
|
497
|
+
destroy: function() {
|
498
|
+
editor.destroy();
|
499
|
+
}
|
500
|
+
};
|
501
|
+
}
|
502
|
+
},
|
503
|
+
{
|
504
|
+
match: parameterEditorsMatch.SingleSelect,
|
505
|
+
createEditor: function(placeholder, options) {
|
506
|
+
var $placeholder = $(placeholder);
|
507
|
+
var enabled = true;
|
508
|
+
$placeholder.html(options.templates["trv-parameter-editor-available-values"]);
|
509
|
+
var $list = $placeholder.find(".trv-list");
|
510
|
+
var $selectNone = $placeholder.find(".trv-select-none");
|
511
|
+
var listView;
|
512
|
+
var parameter;
|
513
|
+
var valueChangeCallback = options.parameterChanged;
|
514
|
+
if ($selectNone) {
|
515
|
+
$selectNone.text(stringResources.stringResources[$selectNone.text()]);
|
516
|
+
$selectNone.click(function(e) {
|
517
|
+
e.preventDefault();
|
518
|
+
listView.clearSelection();
|
519
|
+
listView.trigger("change");
|
520
|
+
});
|
521
|
+
}
|
522
|
+
function onSelectionChanged(selection) {
|
523
|
+
notifyParameterChanged(selection);
|
524
|
+
}
|
525
|
+
function notifyParameterChanged(selection) {
|
526
|
+
var availableValues = parameter.availableValues;
|
527
|
+
var values = $.map(selection, function(item) {
|
528
|
+
return availableValues[$(item).index()].value;
|
529
|
+
});
|
530
|
+
if (Array.isArray(values)) {
|
531
|
+
values = values[0];
|
532
|
+
}
|
533
|
+
valueChangeCallback(parameter, values);
|
534
|
+
}
|
535
|
+
function getSelectedItems() {
|
536
|
+
return listView.select();
|
537
|
+
}
|
538
|
+
function onChange() {
|
539
|
+
onSelectionChanged(getSelectedItems());
|
540
|
+
}
|
541
|
+
function init() {
|
542
|
+
setEditorTabIndex($list);
|
543
|
+
setSelectedItems(parameter.value);
|
544
|
+
listView.bind("change", onChange);
|
545
|
+
}
|
546
|
+
function reset() {
|
547
|
+
if (listView) {
|
548
|
+
listView.unbind("change", onChange);
|
549
|
+
}
|
550
|
+
}
|
551
|
+
function setSelectedItems(value) {
|
552
|
+
var items = $list.find(".trv-listviewitem");
|
553
|
+
utils.each(parameter.availableValues, function(i, av) {
|
554
|
+
var availableValue = av.value;
|
555
|
+
if (value instanceof Date) {
|
556
|
+
availableValue = utils.parseToLocalDate(av.value);
|
557
|
+
}
|
558
|
+
if (utils.areEqual(value, availableValue)) {
|
559
|
+
listView.select(items[i]);
|
560
|
+
return false;
|
561
|
+
}
|
562
|
+
return true;
|
563
|
+
});
|
564
|
+
}
|
565
|
+
return {
|
566
|
+
beginEdit: function(param) {
|
567
|
+
reset();
|
568
|
+
parameter = param;
|
569
|
+
try {
|
570
|
+
listView = $list.kendoListView({
|
571
|
+
template: '<div class="trv-listviewitem">${name}</div>',
|
572
|
+
dataSource: { data: parameter.availableValues },
|
573
|
+
selectable: true,
|
574
|
+
navigatable: navigatableEnabledForList(options.enableAccessibility)
|
575
|
+
}).data("kendoListView");
|
576
|
+
} catch (e) {
|
577
|
+
console.error("Instantiation of Kendo ListView as SingleSelect parameter editor threw an exception", e);
|
578
|
+
throw e;
|
579
|
+
}
|
580
|
+
init();
|
581
|
+
},
|
582
|
+
enable: function(enable) {
|
583
|
+
enabled = enable;
|
584
|
+
enableItem($list, enabled);
|
585
|
+
if (enabled) {
|
586
|
+
listView.bind("change", onChange);
|
587
|
+
$list.addClass("k-selectable");
|
588
|
+
} else {
|
589
|
+
listView.unbind("change", onChange);
|
590
|
+
$list.removeClass("k-selectable");
|
591
|
+
}
|
592
|
+
},
|
593
|
+
addAccessibility: function(param) {
|
594
|
+
var info = utils.stringFormat(stringResources.stringResources.ariaLabelParameterInfo, [param.availableValues.length]);
|
595
|
+
addAccessibilityAttributes($list, stringResources.stringResources.ariaLabelSingleValue, param.text, info, param.Error);
|
596
|
+
var items = $list.find(".trv-listviewitem");
|
597
|
+
utils.each(items, function() {
|
598
|
+
$(this).attr("aria-label", this.innerText);
|
599
|
+
});
|
600
|
+
},
|
601
|
+
setAccessibilityErrorState: function(param) {
|
602
|
+
setAccessibilityErrorAttributes($list, param.Error);
|
603
|
+
},
|
604
|
+
destroy: function() {
|
605
|
+
listView.destroy();
|
606
|
+
}
|
607
|
+
};
|
608
|
+
}
|
609
|
+
},
|
610
|
+
{
|
611
|
+
match: parameterEditorsMatch.SingleSelectCombo,
|
612
|
+
createEditor: function(placeholder, options) {
|
613
|
+
var $placeholder = $(placeholder);
|
614
|
+
var selector = ".trv-combo";
|
615
|
+
var template = "trv-parameter-editor-available-values-combo";
|
616
|
+
var valueChangeCallback = options.parameterChanged;
|
617
|
+
var $editorDom;
|
618
|
+
var $selectNone;
|
619
|
+
var editor;
|
620
|
+
var parameter;
|
621
|
+
$placeholder.html(options.templates[template]);
|
622
|
+
$editorDom = $placeholder.find(selector);
|
623
|
+
$selectNone = $placeholder.find(".trv-select-none");
|
624
|
+
if ($selectNone) {
|
625
|
+
$selectNone.text(stringResources.stringResources[$selectNone.text()]);
|
626
|
+
$selectNone.click(function(e) {
|
627
|
+
e.preventDefault();
|
628
|
+
editor.value("");
|
629
|
+
editor.trigger("change");
|
630
|
+
});
|
631
|
+
}
|
632
|
+
function onSelectionChanged(selection, value) {
|
633
|
+
notifyParameterChanged(selection, value);
|
634
|
+
}
|
635
|
+
function notifyParameterChanged(selection, value) {
|
636
|
+
var values = value || "";
|
637
|
+
var availableValues;
|
638
|
+
if (!value && selection >= 0) {
|
639
|
+
availableValues = parameter.availableValues;
|
640
|
+
values = availableValues[selection].value;
|
641
|
+
}
|
642
|
+
valueChangeCallback(parameter, values);
|
643
|
+
}
|
644
|
+
function getSelectedItems() {
|
645
|
+
return editor.select();
|
646
|
+
}
|
647
|
+
function onChange(e) {
|
648
|
+
onSelectionChanged(getSelectedItems(), this.value());
|
649
|
+
}
|
650
|
+
function init() {
|
651
|
+
setEditorTabIndex($editorDom);
|
652
|
+
editor.bind("change", onChange);
|
653
|
+
}
|
654
|
+
function reset() {
|
655
|
+
if (editor) {
|
656
|
+
editor.unbind("change", onChange);
|
657
|
+
}
|
658
|
+
}
|
659
|
+
return {
|
660
|
+
beginEdit: function(param) {
|
661
|
+
reset();
|
662
|
+
parameter = param;
|
663
|
+
try {
|
664
|
+
editor = $editorDom.kendoComboBox({
|
665
|
+
template: '<div class="trv-editoritem">${name}</div>',
|
666
|
+
dataSource: parameter.availableValues,
|
667
|
+
dataTextField: "name",
|
668
|
+
dataValueField: "value",
|
669
|
+
value: parameter.value,
|
670
|
+
filter: "contains",
|
671
|
+
suggest: true,
|
672
|
+
clearButton: false
|
673
|
+
}).data("kendoComboBox");
|
674
|
+
} catch (e) {
|
675
|
+
console.error("Instantiation of Kendo ComboBox as SingleSelectCombo parameter editor threw an exception", e);
|
676
|
+
throw e;
|
677
|
+
}
|
678
|
+
init();
|
679
|
+
},
|
680
|
+
enable: function(enable) {
|
681
|
+
editor.enable(enable);
|
682
|
+
},
|
683
|
+
addAccessibility: function(param) {
|
684
|
+
var $accessibilityDom = editor.input;
|
685
|
+
var info = utils.stringFormat(stringResources.stringResources.ariaLabelParameterInfo, [param.availableValues.length]);
|
686
|
+
addAccessibilityAttributes($accessibilityDom, stringResources.stringResources.ariaLabelSingleValue, param.text, info, param.Error);
|
687
|
+
var items = editor.items();
|
688
|
+
utils.each(items, function() {
|
689
|
+
$(this).attr("aria-label", this.innerText);
|
690
|
+
});
|
691
|
+
},
|
692
|
+
setAccessibilityErrorState: function(param) {
|
693
|
+
setAccessibilityErrorAttributes($editorDom, param.Error);
|
694
|
+
},
|
695
|
+
destroy: function() {
|
696
|
+
editor.destroy();
|
697
|
+
}
|
698
|
+
};
|
699
|
+
}
|
700
|
+
},
|
701
|
+
{
|
702
|
+
match: parameterEditorsMatch.MultiValue,
|
703
|
+
createEditor: function(placeholder, options) {
|
704
|
+
var $placeholder = $(placeholder);
|
705
|
+
var parameter;
|
706
|
+
$placeholder.html(options.templates["trv-parameter-editor-multivalue"]);
|
707
|
+
var $textArea = $placeholder.find("textarea").on("change", function() {
|
708
|
+
if (options.parameterChanged) {
|
709
|
+
options.parameterChanged(parameter, multivalueUtils.parseValues(this.value));
|
710
|
+
}
|
711
|
+
});
|
712
|
+
function setValue(value) {
|
713
|
+
parameter.value = value;
|
714
|
+
$textArea.val(multivalueUtils.formatValue(value));
|
715
|
+
}
|
716
|
+
return {
|
717
|
+
beginEdit: function(param) {
|
718
|
+
parameter = param;
|
719
|
+
setValue(param.value);
|
720
|
+
setEditorTabIndex($textArea);
|
721
|
+
},
|
722
|
+
enable: function(enable) {
|
723
|
+
enableItem($textArea, enable);
|
724
|
+
$textArea.prop("disabled", !enable);
|
725
|
+
},
|
726
|
+
addAccessibility: function(param) {
|
727
|
+
addAccessibilityAttributes($textArea, stringResources.stringResources.ariaLabelMultiValue, param.text, null, param.Error);
|
728
|
+
},
|
729
|
+
setAccessibilityErrorState: function(param) {
|
730
|
+
setAccessibilityErrorAttributes($textArea, param.Error);
|
731
|
+
}
|
732
|
+
};
|
733
|
+
}
|
734
|
+
},
|
735
|
+
{
|
736
|
+
match: parameterEditorsMatch.DateTime,
|
737
|
+
createEditor: function(placeholder, options) {
|
738
|
+
var $placeholder = $(placeholder);
|
739
|
+
var parameter;
|
740
|
+
$placeholder.html(options.templates["trv-parameter-editor-datetime"]);
|
741
|
+
try {
|
742
|
+
var $dateTimePicker = $placeholder.find("input[type=datetime]").kendoDatePicker({
|
743
|
+
change: function() {
|
744
|
+
var handler = options.parameterChanged;
|
745
|
+
if (handler) {
|
746
|
+
var dtv = this.value();
|
747
|
+
if (null !== dtv) {
|
748
|
+
dtv = utils.adjustTimezone(dtv);
|
749
|
+
}
|
750
|
+
handler(parameter, dtv);
|
751
|
+
}
|
752
|
+
}
|
753
|
+
});
|
754
|
+
var dateTimePicker = $dateTimePicker.data("kendoDatePicker");
|
755
|
+
} catch (e) {
|
756
|
+
console.error("Instantiation of Kendo DatePicker as DateTime parameter editor threw an exception", e);
|
757
|
+
throw e;
|
758
|
+
}
|
759
|
+
function setValue(value) {
|
760
|
+
parameter.value = value;
|
761
|
+
var dt = null;
|
762
|
+
try {
|
763
|
+
if (value) {
|
764
|
+
dt = utils.unadjustTimezone(value);
|
765
|
+
}
|
766
|
+
} catch (e) {
|
767
|
+
dt = null;
|
768
|
+
}
|
769
|
+
dateTimePicker.value(dt);
|
770
|
+
}
|
771
|
+
return {
|
772
|
+
beginEdit: function(param) {
|
773
|
+
parameter = param;
|
774
|
+
setValue(param.value);
|
775
|
+
setEditorTabIndex($dateTimePicker);
|
776
|
+
},
|
777
|
+
enable: function(enable) {
|
778
|
+
dateTimePicker.enable(enable);
|
779
|
+
enableItem($dateTimePicker, enable);
|
780
|
+
},
|
781
|
+
addAccessibility: function(param) {
|
782
|
+
addAccessibilityAttributes($dateTimePicker, stringResources.stringResources.ariaLabelParameterDateTime, param.text, null, param.Error);
|
783
|
+
$dateTimePicker.attr("aria-live", "assertive");
|
784
|
+
},
|
785
|
+
setAccessibilityErrorState: function(param) {
|
786
|
+
setAccessibilityErrorAttributes($dateTimePicker, param.Error);
|
787
|
+
},
|
788
|
+
destroy: function() {
|
789
|
+
dateTimePicker.destroy();
|
790
|
+
}
|
791
|
+
};
|
792
|
+
}
|
793
|
+
},
|
794
|
+
{
|
795
|
+
match: parameterEditorsMatch.String,
|
796
|
+
createEditor: function(placeholder, options) {
|
797
|
+
var $placeholder = $(placeholder);
|
798
|
+
var parameter;
|
799
|
+
$placeholder.html(options.templates["trv-parameter-editor-text"]);
|
800
|
+
var $input = $placeholder.find('input[type="text"]').change(function() {
|
801
|
+
if (options.parameterChanged) {
|
802
|
+
options.parameterChanged(parameter, $input.val());
|
803
|
+
}
|
804
|
+
});
|
805
|
+
function setValue(value) {
|
806
|
+
parameter.value = value;
|
807
|
+
$input.val(value);
|
808
|
+
}
|
809
|
+
return {
|
810
|
+
beginEdit: function(param) {
|
811
|
+
parameter = param;
|
812
|
+
setValue(param.value);
|
813
|
+
setEditorTabIndex($input);
|
814
|
+
},
|
815
|
+
enable: function(enabled) {
|
816
|
+
$input.prop("disabled", !enabled);
|
817
|
+
enableItem($input, enabled);
|
818
|
+
},
|
819
|
+
addAccessibility: function(param) {
|
820
|
+
addAccessibilityAttributes($input, stringResources.stringResources.ariaLabelParameterString, param.text, null, param.Error);
|
821
|
+
$input.attr("aria-live", "assertive");
|
822
|
+
},
|
823
|
+
setAccessibilityErrorState: function(param) {
|
824
|
+
setAccessibilityErrorAttributes($input, param.Error);
|
825
|
+
}
|
826
|
+
};
|
827
|
+
}
|
828
|
+
},
|
829
|
+
{
|
830
|
+
match: parameterEditorsMatch.Number,
|
831
|
+
createEditor: function(placeholder, options) {
|
832
|
+
var $placeholder = $(placeholder);
|
833
|
+
var parameter;
|
834
|
+
var inputBehavior;
|
835
|
+
$placeholder.html(options.templates["trv-parameter-editor-number"]);
|
836
|
+
var $input = $placeholder.find("input[type=number]").on("change", function() {
|
837
|
+
if (options.parameterChanged) {
|
838
|
+
options.parameterChanged(parameter, $input.val());
|
839
|
+
}
|
840
|
+
});
|
841
|
+
return {
|
842
|
+
beginEdit: function(param) {
|
843
|
+
if (inputBehavior) {
|
844
|
+
inputBehavior.dispose();
|
845
|
+
}
|
846
|
+
parameter = param;
|
847
|
+
$input.val(parameter.value);
|
848
|
+
if (parameter.type === enums.ParameterTypes.INTEGER) {
|
849
|
+
inputBehavior = integerInputBehavior($input);
|
850
|
+
} else {
|
851
|
+
inputBehavior = floatInputBehavior($input);
|
852
|
+
}
|
853
|
+
setEditorTabIndex($input);
|
854
|
+
},
|
855
|
+
enable: function(enable) {
|
856
|
+
$input.prop("disabled", !enable);
|
857
|
+
enableItem($input, enable);
|
858
|
+
},
|
859
|
+
addAccessibility: function(param) {
|
860
|
+
addAccessibilityAttributes($input, stringResources.stringResources.ariaLabelParameterNumerical, param.text, null, param.Error);
|
861
|
+
$input.attr("aria-live", "assertive");
|
862
|
+
},
|
863
|
+
setAccessibilityErrorState: function(param) {
|
864
|
+
setAccessibilityErrorAttributes($input, param.Error);
|
865
|
+
}
|
866
|
+
};
|
867
|
+
}
|
868
|
+
},
|
869
|
+
{
|
870
|
+
match: parameterEditorsMatch.Boolean,
|
871
|
+
createEditor: function(placeholder, options) {
|
872
|
+
var $placeholder = $(placeholder);
|
873
|
+
var parameter;
|
874
|
+
$placeholder.html(options.templates["trv-parameter-editor-boolean"]);
|
875
|
+
var $input = $placeholder.find("input[type=checkbox]").on("change", function() {
|
876
|
+
if (options.parameterChanged) {
|
877
|
+
options.parameterChanged(parameter, this.checked);
|
878
|
+
}
|
879
|
+
});
|
880
|
+
function setValue(value) {
|
881
|
+
parameter.value = value;
|
882
|
+
$input[0].checked = value === true;
|
883
|
+
}
|
884
|
+
return {
|
885
|
+
beginEdit: function(param) {
|
886
|
+
parameter = param;
|
887
|
+
setValue(param.value);
|
888
|
+
setEditorTabIndex($input);
|
889
|
+
},
|
890
|
+
enable: function(enable) {
|
891
|
+
enableItem($input, enable);
|
892
|
+
$input.attr("disabled", !enable);
|
893
|
+
},
|
894
|
+
addAccessibility: function(param) {
|
895
|
+
addAccessibilityAttributes($input, stringResources.stringResources.ariaLabelParameterBoolean, param.text, null, param.Error);
|
896
|
+
$input.attr("aria-live", "assertive");
|
897
|
+
},
|
898
|
+
setAccessibilityErrorState: function(param) {
|
899
|
+
setAccessibilityErrorAttributes($input, param.Error);
|
900
|
+
}
|
901
|
+
};
|
902
|
+
}
|
903
|
+
},
|
904
|
+
{
|
905
|
+
match: parameterEditorsMatch.Default,
|
906
|
+
createEditor: function(placeholder, options) {
|
907
|
+
var $placeholder = $(placeholder);
|
908
|
+
$placeholder.html('<div class="trv-parameter-editor-generic"></div>');
|
909
|
+
return {
|
910
|
+
beginEdit: function(parameter) {
|
911
|
+
$placeholder.find(".trv-parameter-editor-generic").text(parameter.Error ? "(error)" : parameter.value);
|
912
|
+
},
|
913
|
+
enable: function(enable) {
|
914
|
+
}
|
915
|
+
};
|
916
|
+
}
|
917
|
+
}
|
918
|
+
];
|
919
|
+
|
920
|
+
exports.ParameterEditors = ParameterEditors;
|
921
|
+
exports.parameterEditorsMatch = parameterEditorsMatch;
|