@progress/kendo-vue-dropdowns 3.9.3 → 3.9.4-dev.202304210655

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.
Files changed (65) hide show
  1. package/dist/cdn/js/kendo-vue-dropdowns.js +1 -1
  2. package/dist/es/ComboBox/ComboBox.js +3 -1
  3. package/dist/es/DropDownTree/DropDownTree.d.ts +1 -0
  4. package/dist/es/DropDownTree/DropDownTree.js +639 -0
  5. package/dist/es/DropDownTree/DropDownTreeProps.d.ts +278 -0
  6. package/dist/es/DropDownTree/DropDownTreeProps.js +2 -0
  7. package/dist/es/DropDownTree/ListNoData.d.ts +42 -0
  8. package/dist/es/DropDownTree/ListNoData.js +32 -0
  9. package/dist/es/DropDownTree/useDropdownWidth.d.ts +4 -0
  10. package/dist/es/DropDownTree/useDropdownWidth.js +10 -0
  11. package/dist/es/MultiSelectTree/MultiSelectTree.d.ts +48 -0
  12. package/dist/es/MultiSelectTree/MultiSelectTree.js +896 -0
  13. package/dist/es/MultiSelectTree/MultiSelectTreeProps.d.ts +306 -0
  14. package/dist/es/MultiSelectTree/MultiSelectTreeProps.js +2 -0
  15. package/dist/es/MultiSelectTree/utils.d.ts +17 -0
  16. package/dist/es/MultiSelectTree/utils.js +109 -0
  17. package/dist/es/common/ListFilter.js +15 -3
  18. package/dist/es/common/utils.d.ts +6 -1
  19. package/dist/es/common/utils.js +10 -1
  20. package/dist/es/main.d.ts +5 -1
  21. package/dist/es/main.js +5 -1
  22. package/dist/es/package-metadata.js +1 -1
  23. package/dist/esm/ComboBox/ComboBox.js +3 -1
  24. package/dist/esm/DropDownTree/DropDownTree.d.ts +1 -0
  25. package/dist/esm/DropDownTree/DropDownTree.js +639 -0
  26. package/dist/esm/DropDownTree/DropDownTreeProps.d.ts +278 -0
  27. package/dist/esm/DropDownTree/DropDownTreeProps.js +2 -0
  28. package/dist/esm/DropDownTree/ListNoData.d.ts +42 -0
  29. package/dist/esm/DropDownTree/ListNoData.js +32 -0
  30. package/dist/esm/DropDownTree/useDropdownWidth.d.ts +4 -0
  31. package/dist/esm/DropDownTree/useDropdownWidth.js +10 -0
  32. package/dist/esm/MultiSelectTree/MultiSelectTree.d.ts +48 -0
  33. package/dist/esm/MultiSelectTree/MultiSelectTree.js +896 -0
  34. package/dist/esm/MultiSelectTree/MultiSelectTreeProps.d.ts +306 -0
  35. package/dist/esm/MultiSelectTree/MultiSelectTreeProps.js +2 -0
  36. package/dist/esm/MultiSelectTree/utils.d.ts +17 -0
  37. package/dist/esm/MultiSelectTree/utils.js +109 -0
  38. package/dist/esm/common/ListFilter.js +15 -3
  39. package/dist/esm/common/utils.d.ts +6 -1
  40. package/dist/esm/common/utils.js +10 -1
  41. package/dist/esm/main.d.ts +5 -1
  42. package/dist/esm/main.js +5 -1
  43. package/dist/esm/package-metadata.js +1 -1
  44. package/dist/npm/ComboBox/ComboBox.js +3 -1
  45. package/dist/npm/DropDownTree/DropDownTree.d.ts +1 -0
  46. package/dist/npm/DropDownTree/DropDownTree.js +640 -0
  47. package/dist/npm/DropDownTree/DropDownTreeProps.d.ts +278 -0
  48. package/dist/npm/DropDownTree/DropDownTreeProps.js +3 -0
  49. package/dist/npm/DropDownTree/ListNoData.d.ts +42 -0
  50. package/dist/npm/DropDownTree/ListNoData.js +39 -0
  51. package/dist/npm/DropDownTree/useDropdownWidth.d.ts +4 -0
  52. package/dist/npm/DropDownTree/useDropdownWidth.js +17 -0
  53. package/dist/npm/MultiSelectTree/MultiSelectTree.d.ts +48 -0
  54. package/dist/npm/MultiSelectTree/MultiSelectTree.js +903 -0
  55. package/dist/npm/MultiSelectTree/MultiSelectTreeProps.d.ts +306 -0
  56. package/dist/npm/MultiSelectTree/MultiSelectTreeProps.js +3 -0
  57. package/dist/npm/MultiSelectTree/utils.d.ts +17 -0
  58. package/dist/npm/MultiSelectTree/utils.js +114 -0
  59. package/dist/npm/common/ListFilter.js +15 -3
  60. package/dist/npm/common/utils.d.ts +6 -1
  61. package/dist/npm/common/utils.js +11 -1
  62. package/dist/npm/main.d.ts +5 -1
  63. package/dist/npm/main.js +20 -1
  64. package/dist/npm/package-metadata.js +1 -1
  65. package/package.json +12 -8
@@ -0,0 +1,903 @@
1
+ "use strict";
2
+
3
+ var __assign = undefined && undefined.__assign || function () {
4
+ __assign = Object.assign || function (t) {
5
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6
+ s = arguments[i];
7
+ for (var p in s) {
8
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
9
+ }
10
+ }
11
+ return t;
12
+ };
13
+ return __assign.apply(this, arguments);
14
+ };
15
+ var __spreadArray = undefined && undefined.__spreadArray || function (to, from, pack) {
16
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
17
+ if (ar || !(i in from)) {
18
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
19
+ ar[i] = from[i];
20
+ }
21
+ }
22
+ return to.concat(ar || Array.prototype.slice.call(from));
23
+ };
24
+ Object.defineProperty(exports, "__esModule", {
25
+ value: true
26
+ });
27
+ exports.MultiSelectTreeVue2 = exports.MultiSelectTree = void 0;
28
+ // @ts-ignore
29
+ var Vue = require("vue");
30
+ var allVue = Vue;
31
+ var gh = allVue.h;
32
+ var isV3 = allVue.version && allVue.version[0] === '3';
33
+ var kendo_vue_common_1 = require("@progress/kendo-vue-common");
34
+ var kendo_vue_popup_1 = require("@progress/kendo-vue-popup");
35
+ var kendo_vue_intl_1 = require("@progress/kendo-vue-intl");
36
+ var kendo_vue_treeview_1 = require("@progress/kendo-vue-treeview");
37
+ var package_metadata_1 = require("./../package-metadata");
38
+ var utils_1 = require("../common/utils");
39
+ var ListNoData_1 = require("./../DropDownTree/ListNoData");
40
+ var main_1 = require("./../messages/main");
41
+ var kendo_vue_labels_1 = require("@progress/kendo-vue-labels");
42
+ var TagList_1 = require("../MultiSelect/TagList");
43
+ var ClearButton_1 = require("../common/ClearButton");
44
+ var ListFilter_1 = require("../common/ListFilter");
45
+ var VALIDATION_MESSAGE = 'Please select a value from the list!';
46
+ var sizeMap = kendo_vue_common_1.kendoThemeMaps.sizeMap,
47
+ roundedMap = kendo_vue_common_1.kendoThemeMaps.roundedMap;
48
+ var toLevel = function toLevel(hierarchicalIndex) {
49
+ return hierarchicalIndex.split('_').map(function (i) {
50
+ return parseInt(i, 10);
51
+ });
52
+ };
53
+ var getValidity = function getValidity(parameters, hasValue) {
54
+ var validationMessage = parameters.validationMessage,
55
+ valid = parameters.valid,
56
+ required = parameters.required;
57
+ return {
58
+ customError: validationMessage !== undefined,
59
+ valid: Boolean(valid !== undefined ? valid : !required || hasValue),
60
+ valueMissing: !hasValue
61
+ };
62
+ };
63
+ /**
64
+ * @hidden
65
+ */
66
+ var MultiSelectTreeVue2 = {
67
+ name: 'KendoMultiSelectTree',
68
+ // @ts-ignore
69
+ emits: {
70
+ open: null,
71
+ close: null,
72
+ focus: null,
73
+ blur: null,
74
+ change: null,
75
+ filterChange: null,
76
+ expandChange: null
77
+ },
78
+ props: {
79
+ opened: {
80
+ type: Boolean,
81
+ default: undefined
82
+ },
83
+ disabled: Boolean,
84
+ dir: String,
85
+ tabIndex: Number,
86
+ accessKey: String,
87
+ dataItems: {
88
+ type: Array,
89
+ default: function _default() {
90
+ return [];
91
+ }
92
+ },
93
+ value: Array,
94
+ valueMap: Function,
95
+ placeholder: String,
96
+ dataItemKey: {
97
+ type: String,
98
+ required: true
99
+ },
100
+ textField: {
101
+ type: String,
102
+ required: true
103
+ },
104
+ checkField: {
105
+ type: String,
106
+ default: 'checkField'
107
+ },
108
+ checkIndeterminateField: {
109
+ type: String,
110
+ default: 'checkIndeterminateField'
111
+ },
112
+ expandField: String,
113
+ subItemsField: {
114
+ type: String,
115
+ default: 'items'
116
+ },
117
+ className: String,
118
+ label: String,
119
+ validationMessage: String,
120
+ validityStyles: {
121
+ type: Boolean,
122
+ default: true
123
+ },
124
+ valid: {
125
+ type: Boolean,
126
+ default: true
127
+ },
128
+ required: Boolean,
129
+ name: String,
130
+ id: String,
131
+ ariaLabelledBy: String,
132
+ ariaDescribedBy: String,
133
+ filterable: Boolean,
134
+ filter: String,
135
+ loading: Boolean,
136
+ tags: Array,
137
+ popupSettings: {
138
+ type: Object,
139
+ default: function _default() {
140
+ return {
141
+ animate: true,
142
+ height: '200px'
143
+ };
144
+ }
145
+ },
146
+ size: {
147
+ type: String,
148
+ default: 'medium',
149
+ validator: function validator(value) {
150
+ return [null, 'small', 'medium', 'large'].includes(value);
151
+ }
152
+ },
153
+ rounded: {
154
+ type: String,
155
+ default: 'medium',
156
+ validator: function validator(value) {
157
+ return [null, 'small', 'medium', 'large', 'full'].includes(value);
158
+ }
159
+ },
160
+ fillMode: {
161
+ type: String,
162
+ default: 'solid',
163
+ validator: function validator(value) {
164
+ return [null, 'flat', 'outline', 'solid'].includes(value);
165
+ }
166
+ },
167
+ item: [String, Function, Object],
168
+ tag: [String, Function, Object],
169
+ header: [String, Function, Object],
170
+ footer: [String, Function, Object],
171
+ listNoData: [String, Function, Object]
172
+ },
173
+ inject: {
174
+ kendoLocalizationService: {
175
+ default: null
176
+ }
177
+ },
178
+ created: function created() {
179
+ (0, kendo_vue_common_1.validatePackage)(package_metadata_1.packageMetadata);
180
+ this.componentGuid = (0, kendo_vue_common_1.guid)();
181
+ this.anchor = (0, kendo_vue_common_1.guid)();
182
+ },
183
+ data: function data() {
184
+ return {
185
+ focusedTagState: undefined,
186
+ openState: false,
187
+ focusedState: false,
188
+ filterState: '',
189
+ currentValue: [],
190
+ popupWidth: '200px'
191
+ };
192
+ },
193
+ computed: {
194
+ isOpen: function isOpen() {
195
+ return this.opened !== undefined ? this.opened : this.openState;
196
+ },
197
+ computedValue: function computedValue() {
198
+ return this.value !== undefined ? this.value : this.currentValue;
199
+ },
200
+ hasValue: function hasValue() {
201
+ return !!this.computedValue.length;
202
+ },
203
+ tagsToRenderRef: function tagsToRenderRef() {
204
+ var _this = this;
205
+ return this.tags === undefined ? this.computedValue.map(function (item) {
206
+ return {
207
+ text: (0, utils_1.getItemValue)(item, _this.$props.textField),
208
+ data: [item]
209
+ };
210
+ }) : __spreadArray([], this.tags, true);
211
+ }
212
+ },
213
+ mounted: function mounted() {
214
+ this.elementRef = (0, kendo_vue_common_1.getRef)(this, 'kendoAnchor', this.anchor);
215
+ this.inputRef = (0, kendo_vue_common_1.getRef)(this, 'input');
216
+ this.selectRef = (0, kendo_vue_common_1.getRef)(this, 'select');
217
+ this.treeViewRef = (0, kendo_vue_common_1.getRef)(this, 'treeView');
218
+ this.skipFocusRef = false;
219
+ this.popupRef = (0, kendo_vue_common_1.getRef)(this, 'popup');
220
+ this.calculatePopupWidth();
221
+ },
222
+ updated: function updated() {
223
+ this.inputRef = (0, kendo_vue_common_1.getRef)(this, 'input');
224
+ this.treeViewRef = (0, kendo_vue_common_1.getRef)(this, 'treeView');
225
+ if (this.popupRef && this.isOpen && this.hasValue) {
226
+ this.popupRef.reposition();
227
+ }
228
+ this.setValidity();
229
+ this.calculatePopupWidth();
230
+ },
231
+ // @ts-ignore
232
+ setup: !isV3 ? undefined : function () {
233
+ var v3 = !!isV3;
234
+ return {
235
+ v3: v3
236
+ };
237
+ },
238
+ // @ts-ignore
239
+ render: function render(createElement) {
240
+ var _this2 = this;
241
+ var _a, _b;
242
+ var _this = this;
243
+ var h = gh || createElement;
244
+ var id = this.$props.id || this.componentGuid;
245
+ var _c = this.$props,
246
+ dataItems = _c.dataItems,
247
+ dataItemKey = _c.dataItemKey,
248
+ _d = _c.popupSettings,
249
+ popupSettings = _d === void 0 ? {} : _d,
250
+ disabled = _c.disabled,
251
+ placeholder = _c.placeholder,
252
+ label = _c.label,
253
+ name = _c.name,
254
+ checkField = _c.checkField,
255
+ checkIndeterminateField = _c.checkIndeterminateField,
256
+ subItemsField = _c.subItemsField,
257
+ validationMessage = _c.validationMessage,
258
+ valid = _c.valid,
259
+ value = _c.value,
260
+ required = _c.required,
261
+ validityStyles = _c.validityStyles;
262
+ var tabIndex = (0, kendo_vue_common_1.getTabIndex)(this.$props.tabIndex, disabled);
263
+ var localization = (0, kendo_vue_intl_1.provideLocalizationService)(this);
264
+ var validity = getValidity({
265
+ validationMessage: validationMessage,
266
+ valid: valid,
267
+ required: required
268
+ }, this.hasValue);
269
+ var dir = this.$props.dir; // useRtl(elementRef,this.$props.dir);
270
+ var itemTemplate = kendo_vue_common_1.templateRendering.call(this, this.item, kendo_vue_common_1.getListeners.call(this));
271
+ var tagTemplate = kendo_vue_common_1.templateRendering.call(this, this.tag, kendo_vue_common_1.getListeners.call(this));
272
+ var headerTemplate = kendo_vue_common_1.templateRendering.call(this, this.$props.header, kendo_vue_common_1.getListeners.call(this));
273
+ var footerTemplate = kendo_vue_common_1.templateRendering.call(this, this.$props.footer, kendo_vue_common_1.getListeners.call(this));
274
+ var header = kendo_vue_common_1.getTemplate.call(this, {
275
+ h: h,
276
+ template: headerTemplate
277
+ });
278
+ var footer = kendo_vue_common_1.getTemplate.call(this, {
279
+ h: h,
280
+ template: footerTemplate
281
+ });
282
+ var listNoDataRender = kendo_vue_common_1.templateRendering.call(this, this.$props.listNoData, kendo_vue_common_1.getListeners.call(this));
283
+ var noDataDefault =
284
+ // @ts-ignore function children
285
+ h(ListNoData_1.ListNoData, this.v3 ? function () {
286
+ return [localization.toLanguageString(main_1.nodata, main_1.messages[main_1.nodata])];
287
+ } : [localization.toLanguageString(main_1.nodata, main_1.messages[main_1.nodata])]);
288
+ var noDataTemplate = kendo_vue_common_1.getTemplate.call(this, {
289
+ h: h,
290
+ defaultRendering: noDataDefault,
291
+ template: listNoDataRender
292
+ });
293
+ var isValid = !validityStyles || validity.valid;
294
+ var _e = this.$props,
295
+ size = _e.size,
296
+ rounded = _e.rounded,
297
+ fillMode = _e.fillMode;
298
+ var multiselecttree = h("span", {
299
+ ref: (0, kendo_vue_common_1.setRef)(this, 'kendoAnchor', this.anchor),
300
+ "class": (0, kendo_vue_common_1.classNames)('k-multiselect k-input', this.$props.className, (_a = {}, _a["k-input-".concat(sizeMap[size] || size)] = size, _a["k-rounded-".concat(roundedMap[rounded] || rounded)] = rounded, _a["k-input-".concat(fillMode)] = fillMode, _a['k-focus'] = this.focusedState && !disabled, _a['k-invalid'] = !isValid, _a['k-disabled'] = disabled, _a['k-loading'] = this.$props.loading, _a['k-required'] = required, _a)),
301
+ tabIndex: tabIndex,
302
+ attrs: this.v3 ? undefined : {
303
+ tabIndex: tabIndex,
304
+ accessKey: this.$props.accessKey,
305
+ id: id,
306
+ dir: dir,
307
+ role: "combobox",
308
+ "aria-haspopup": "true",
309
+ "aria-expanded": this.isOpen,
310
+ "aria-disabled": disabled,
311
+ "aria-label": label,
312
+ "aria-labelledby": this.$props.ariaLabelledBy,
313
+ "aria-describedby": this.$props.ariaDescribedBy,
314
+ "aria-required": this.$props.required
315
+ },
316
+ accessKey: this.$props.accessKey,
317
+ id: id,
318
+ dir: dir,
319
+ onKeydown: this.onWrapperKeyDown,
320
+ on: this.v3 ? undefined : {
321
+ "keydown": this.onWrapperKeyDown,
322
+ "mousedown": this.onWrapperMouseDown,
323
+ "focus": this.onFocus,
324
+ "blur": this.onBlur,
325
+ "click": this.onWrapperClick
326
+ },
327
+ onMousedown: this.onWrapperMouseDown,
328
+ onFocus: this.onFocus,
329
+ onBlur: this.onBlur,
330
+ role: "combobox",
331
+ "aria-haspopup": "true",
332
+ "aria-expanded": this.isOpen,
333
+ "aria-disabled": disabled,
334
+ "aria-label": label,
335
+ "aria-labelledby": this.$props.ariaLabelledBy,
336
+ "aria-describedby": this.$props.ariaDescribedBy,
337
+ "aria-required": this.$props.required,
338
+ onClick: this.onWrapperClick
339
+ }, [h("div", {
340
+ id: 'tagslist-' + id,
341
+ attrs: this.v3 ? undefined : {
342
+ id: 'tagslist-' + id
343
+ },
344
+ "class": (0, kendo_vue_common_1.classNames)('k-input-values k-chip-list k-selection-multiple', (_b = {}, _b["k-chip-list-".concat(sizeMap[size] || size)] = size, _b['k-readonly'] = this.hasValue, _b))
345
+ }, [this.tagsToRenderRef.length > 0 ? h(TagList_1.TagList, {
346
+ tagRender: tagTemplate,
347
+ attrs: this.v3 ? undefined : {
348
+ tagRender: tagTemplate,
349
+ dataItems: this.tagsToRenderRef,
350
+ guid: id,
351
+ focused: this.focusedTagState ? this.tagsToRenderRef.find(function (t) {
352
+ return (0, utils_1.matchTags)(t, _this.focusedTagState, dataItemKey);
353
+ }) : undefined,
354
+ size: size
355
+ },
356
+ onTagdelete: this.onTagDelete,
357
+ on: this.v3 ? undefined : {
358
+ "tagdelete": this.onTagDelete
359
+ },
360
+ dataItems: this.tagsToRenderRef,
361
+ guid: id,
362
+ focused: this.focusedTagState ? this.tagsToRenderRef.find(function (t) {
363
+ return (0, utils_1.matchTags)(t, _this.focusedTagState, dataItemKey);
364
+ }) : undefined,
365
+ size: size
366
+ }) : !this.hasValue && h("span", {
367
+ "class": "k-input-inner",
368
+ role: 'combobox',
369
+ attrs: this.v3 ? undefined : {
370
+ role: 'combobox',
371
+ tabIndex: tabIndex,
372
+ "aria-expanded": this.isOpen,
373
+ "aria-describedby": 'tagslist-' + id,
374
+ "aria-label": this.$props.ariaLabelledBy
375
+ },
376
+ tabIndex: tabIndex,
377
+ "aria-expanded": this.isOpen,
378
+ "aria-describedby": 'tagslist-' + id,
379
+ "aria-label": this.$props.ariaLabelledBy
380
+ }, [h("span", {
381
+ "class": "k-input-value-text"
382
+ }, [placeholder])])]), this.$props.loading && h(kendo_vue_common_1.Icon, {
383
+ "class": "k-input-loading-icon",
384
+ name: "loading",
385
+ attrs: this.v3 ? undefined : {
386
+ name: "loading"
387
+ }
388
+ }), this.hasValue && !disabled && h(ClearButton_1.ClearButton, {
389
+ onClearclick: this.onClear,
390
+ on: this.v3 ? undefined : {
391
+ "clearclick": this.onClear
392
+ }
393
+ }), /* Dummy component to support forms */h("select", {
394
+ name: name,
395
+ attrs: this.v3 ? undefined : {
396
+ name: name,
397
+ tabIndex: -1,
398
+ "aria-hidden": true,
399
+ title: label
400
+ },
401
+ ref: (0, kendo_vue_common_1.setRef)(this, 'select'),
402
+ tabIndex: -1,
403
+ "aria-hidden": true,
404
+ title: label,
405
+ style: {
406
+ opacity: 0,
407
+ width: 1,
408
+ border: 0,
409
+ zIndex: -1,
410
+ position: 'absolute',
411
+ left: '50%'
412
+ }
413
+ }, [h("option", {
414
+ value: this.v3 ? this.$props.valueMap ? this.$props.valueMap.call(undefined, value) : value : null,
415
+ domProps: this.v3 ? undefined : {
416
+ "value": this.$props.valueMap ? this.$props.valueMap.call(undefined, value) : value
417
+ }
418
+ })]),
419
+ // @ts-ignore function children
420
+ h(kendo_vue_popup_1.Popup, {
421
+ style: {
422
+ width: this.popupWidth,
423
+ direction: dir
424
+ },
425
+ popupClass: (0, kendo_vue_common_1.classNames)(popupSettings.popupClass, 'k-list-container', 'k-multiselecttree-popup', 'popup-' + this.componentGuid),
426
+ attrs: this.v3 ? undefined : {
427
+ popupClass: (0, kendo_vue_common_1.classNames)(popupSettings.popupClass, 'k-list-container', 'k-multiselecttree-popup', 'popup-' + this.componentGuid),
428
+ animate: popupSettings.animate,
429
+ anchor: this.anchor,
430
+ show: this.isOpen,
431
+ appendTo: popupSettings.appendTo
432
+ },
433
+ "class": (0, kendo_vue_common_1.classNames)(popupSettings.className, {
434
+ 'k-rtl': dir === 'rtl'
435
+ }),
436
+ animate: popupSettings.animate,
437
+ anchor: this.anchor,
438
+ show: this.isOpen,
439
+ onOpen: this.onPopupOpened,
440
+ on: this.v3 ? undefined : {
441
+ "open": this.onPopupOpened,
442
+ "close": this.onPopupClosed
443
+ },
444
+ onClose: this.onPopupClosed,
445
+ appendTo: popupSettings.appendTo,
446
+ ref: (0, kendo_vue_common_1.setRef)(this, 'popup')
447
+ }, this.v3 ? function () {
448
+ return [_this2.$props.filterable &&
449
+ // @ts-ignore
450
+ h(ListFilter_1.ListFilter, {
451
+ value: _this2.$props.filter === undefined ? _this2.filterState : _this2.$props.filter,
452
+ attrs: _this2.v3 ? undefined : {
453
+ value: _this2.$props.filter === undefined ? _this2.filterState : _this2.$props.filter,
454
+ size: size,
455
+ rounded: rounded,
456
+ fillMode: fillMode
457
+ },
458
+ ref: (0, kendo_vue_common_1.setRef)(_this2, 'input'),
459
+ onChange: _this2.onFilterChange,
460
+ on: _this2.v3 ? undefined : {
461
+ "change": _this2.onFilterChange,
462
+ "keydown": _this2.onInputKeyDown,
463
+ "focus": _this2.onFocus,
464
+ "blur": _this2.onBlur
465
+ },
466
+ onKeydown: _this2.onInputKeyDown,
467
+ size: size,
468
+ rounded: rounded,
469
+ fillMode: fillMode,
470
+ onFocus: _this2.onFocus,
471
+ onBlur: _this2.onBlur
472
+ }), header && h("div", {
473
+ "class": "k-list-header"
474
+ }, [header]), dataItems.length > 0 ?
475
+ // @ts-ignore
476
+ h(kendo_vue_treeview_1.TreeView, {
477
+ ref: (0, kendo_vue_common_1.setRef)(_this2, 'treeView'),
478
+ tabIndex: tabIndex,
479
+ attrs: _this2.v3 ? undefined : {
480
+ tabIndex: tabIndex,
481
+ dataItems: dataItems,
482
+ focusIdField: dataItemKey,
483
+ textField: _this2.$props.textField,
484
+ checkField: checkField,
485
+ checkIndeterminateField: checkIndeterminateField,
486
+ expandField: _this2.$props.expandField,
487
+ childrenField: subItemsField,
488
+ expandIcons: true,
489
+ checkboxes: true,
490
+ size: size,
491
+ item: itemTemplate
492
+ },
493
+ dataItems: dataItems,
494
+ focusIdField: dataItemKey,
495
+ textField: _this2.$props.textField,
496
+ checkField: checkField,
497
+ checkIndeterminateField: checkIndeterminateField,
498
+ expandField: _this2.$props.expandField,
499
+ childrenField: subItemsField,
500
+ expandIcons: true,
501
+ onItemclick: _this2.onChange,
502
+ on: _this2.v3 ? undefined : {
503
+ "itemclick": _this2.onChange,
504
+ "checkchange": _this2.onChange,
505
+ "expandchange": _this2.onExpand,
506
+ "focus": _this2.onFocus,
507
+ "blur": _this2.onBlur,
508
+ "keydown": _this2.onWrapperKeyDown
509
+ },
510
+ onCheckchange: _this2.onChange,
511
+ onExpandchange: _this2.onExpand,
512
+ onFocus: _this2.onFocus,
513
+ onBlur: _this2.onBlur,
514
+ onKeydown: _this2.onWrapperKeyDown,
515
+ checkboxes: true,
516
+ size: size,
517
+ item: itemTemplate
518
+ }) : noDataTemplate, footer && h("div", {
519
+ "class": "k-list-footer"
520
+ }, [footer])];
521
+ } : [_this2.$props.filterable && h(ListFilter_1.ListFilter, {
522
+ value: _this2.$props.filter === undefined ? _this2.filterState : _this2.$props.filter,
523
+ attrs: _this2.v3 ? undefined : {
524
+ value: _this2.$props.filter === undefined ? _this2.filterState : _this2.$props.filter,
525
+ size: size,
526
+ rounded: rounded,
527
+ fillMode: fillMode
528
+ },
529
+ ref: (0, kendo_vue_common_1.setRef)(_this2, 'input'),
530
+ onChange: _this2.onFilterChange,
531
+ on: _this2.v3 ? undefined : {
532
+ "change": _this2.onFilterChange,
533
+ "keydown": _this2.onInputKeyDown,
534
+ "focus": _this2.onFocus,
535
+ "blur": _this2.onBlur
536
+ },
537
+ onKeydown: _this2.onInputKeyDown,
538
+ size: size,
539
+ rounded: rounded,
540
+ fillMode: fillMode,
541
+ onFocus: _this2.onFocus,
542
+ onBlur: _this2.onBlur
543
+ }), header && h("div", {
544
+ "class": "k-list-header"
545
+ }, [header]), dataItems.length > 0 ? h(kendo_vue_treeview_1.TreeView, {
546
+ ref: (0, kendo_vue_common_1.setRef)(_this2, 'treeView'),
547
+ tabIndex: tabIndex,
548
+ attrs: _this2.v3 ? undefined : {
549
+ tabIndex: tabIndex,
550
+ dataItems: dataItems,
551
+ focusIdField: dataItemKey,
552
+ textField: _this2.$props.textField,
553
+ checkField: checkField,
554
+ checkIndeterminateField: checkIndeterminateField,
555
+ expandField: _this2.$props.expandField,
556
+ childrenField: subItemsField,
557
+ expandIcons: true,
558
+ checkboxes: true,
559
+ size: size,
560
+ item: itemTemplate
561
+ },
562
+ dataItems: dataItems,
563
+ focusIdField: dataItemKey,
564
+ textField: _this2.$props.textField,
565
+ checkField: checkField,
566
+ checkIndeterminateField: checkIndeterminateField,
567
+ expandField: _this2.$props.expandField,
568
+ childrenField: subItemsField,
569
+ expandIcons: true,
570
+ onItemclick: _this2.onChange,
571
+ on: _this2.v3 ? undefined : {
572
+ "itemclick": _this2.onChange,
573
+ "checkchange": _this2.onChange,
574
+ "expandchange": _this2.onExpand,
575
+ "focus": _this2.onFocus,
576
+ "blur": _this2.onBlur,
577
+ "keydown": _this2.onWrapperKeyDown
578
+ },
579
+ onCheckchange: _this2.onChange,
580
+ onExpandchange: _this2.onExpand,
581
+ onFocus: _this2.onFocus,
582
+ onBlur: _this2.onBlur,
583
+ onKeydown: _this2.onWrapperKeyDown,
584
+ checkboxes: true,
585
+ size: size,
586
+ item: itemTemplate
587
+ }) : noDataTemplate, footer && h("div", {
588
+ "class": "k-list-footer"
589
+ }, [footer])])]);
590
+ return label ?
591
+ // @ts-ignore function children
592
+ h(kendo_vue_labels_1.FloatingLabel, {
593
+ label: label,
594
+ attrs: this.v3 ? undefined : {
595
+ label: label,
596
+ editorValue: this.hasValue,
597
+ editorPlaceholder: placeholder,
598
+ editorValid: isValid,
599
+ editorDisabled: disabled,
600
+ editorId: id,
601
+ dir: dir
602
+ },
603
+ editorValue: this.hasValue,
604
+ editorPlaceholder: placeholder,
605
+ editorValid: isValid,
606
+ editorDisabled: disabled,
607
+ editorId: id,
608
+ dir: dir
609
+ }, this.v3 ? function () {
610
+ return [multiselecttree];
611
+ } : [multiselecttree]) : multiselecttree;
612
+ },
613
+ methods: {
614
+ calculatePopupWidth: function calculatePopupWidth() {
615
+ if (this.elementRef) {
616
+ this.popupWidth = this.popupSettings.width !== undefined ? this.popupSettings.width : this.elementRef.offsetWidth + 'px';
617
+ }
618
+ },
619
+ focus: function focus() {
620
+ if (this.$el) {
621
+ this.$el.focus();
622
+ }
623
+ },
624
+ setValidity: function setValidity() {
625
+ if (this.selectRef && this.selectRef.setCustomValidity) {
626
+ var _a = this.$props,
627
+ validationMessage = _a.validationMessage,
628
+ valid = _a.valid,
629
+ required = _a.required;
630
+ var validity = getValidity({
631
+ validationMessage: validationMessage,
632
+ valid: valid,
633
+ required: required
634
+ }, this.hasValue);
635
+ this.selectRef.setCustomValidity(validity.valid ? '' : this.validationMessage === undefined ? VALIDATION_MESSAGE : this.validationMessage);
636
+ }
637
+ },
638
+ changeValue: function changeValue(event, relatedItems, operation) {
639
+ var changeEvent = __assign({
640
+ items: relatedItems,
641
+ operation: operation
642
+ }, event);
643
+ this.$emit('change', changeEvent);
644
+ },
645
+ onChange: function onChange(e) {
646
+ if ((0, utils_1.areSame)(e.item, this.computedValue, this.dataItemKey)) {
647
+ return;
648
+ }
649
+ var item = e.item,
650
+ event = e.event;
651
+ var ev = {
652
+ event: event,
653
+ target: this
654
+ };
655
+ this.changeValue(ev, [item], 'toggle');
656
+ },
657
+ openPopup: function openPopup(event) {
658
+ if (!this.isOpen) {
659
+ var openEvent = __assign({}, event);
660
+ this.$emit('open', openEvent);
661
+ if (this.opened === undefined) {
662
+ this.openState = true;
663
+ }
664
+ }
665
+ },
666
+ closePopup: function closePopup(event) {
667
+ if (this.isOpen) {
668
+ var closeEvent = __assign({}, event);
669
+ this.$emit('close', closeEvent);
670
+ if (this.opened === undefined) {
671
+ this.openState = false;
672
+ }
673
+ }
674
+ },
675
+ switchFocus: function switchFocus(focusFn) {
676
+ var _this = this;
677
+ this.skipFocusRef = true;
678
+ focusFn();
679
+ window.setTimeout(function () {
680
+ return _this.skipFocusRef = false;
681
+ }, 0);
682
+ },
683
+ focusElement: function focusElement(element) {
684
+ if (element) {
685
+ this.switchFocus(function () {
686
+ return element.focus();
687
+ });
688
+ }
689
+ },
690
+ onPopupOpened: function onPopupOpened() {
691
+ if (!this.focusedState && this.isOpen) {
692
+ this.closePopup({
693
+ target: this
694
+ });
695
+ } else {
696
+ if (this.$props.filterable) {
697
+ var inputElement = this.inputRef && this.inputRef.input;
698
+ this.focusElement(inputElement);
699
+ } else {
700
+ this.focusElement(this.treeViewRef && this.treeViewRef.input);
701
+ }
702
+ }
703
+ },
704
+ onPopupClosed: function onPopupClosed() {
705
+ if (this.focusedState) {
706
+ // Move the focus from treeview to dropdown without triggering Focus or Blur events.
707
+ this.focusElement(this.$el);
708
+ }
709
+ },
710
+ onFocus: function onFocus(event) {
711
+ if (!this.focusedState && !this.skipFocusRef) {
712
+ this.focusedState = true;
713
+ var focusEvent = {
714
+ event: event,
715
+ target: this
716
+ };
717
+ this.$emit('focus', focusEvent);
718
+ }
719
+ },
720
+ onBlur: function onBlur(event) {
721
+ if (this.focusedState && !this.skipFocusRef) {
722
+ this.focusedTagState = undefined;
723
+ this.focusedState = false;
724
+ var ev = {
725
+ event: event,
726
+ target: this
727
+ };
728
+ var focusEvent = __assign({}, ev);
729
+ if (!event.relatedTarget || !event.relatedTarget.closest('.popup-' + this.componentGuid)) {
730
+ this.$emit('blur', focusEvent);
731
+ this.closePopup(ev);
732
+ }
733
+ }
734
+ },
735
+ onWrapperMouseDown: function onWrapperMouseDown() {
736
+ if (this.focusedState) {
737
+ // moving focus from treeview to dropdown triggers Focus and Blur events.
738
+ this.switchFocus(kendo_vue_common_1.noop);
739
+ }
740
+ },
741
+ onWrapperClick: function onWrapperClick(event) {
742
+ if (!this.$props.disabled && !event.defaultPrevented) {
743
+ this.focusedState = true;
744
+ var ev = {
745
+ event: event,
746
+ target: this
747
+ };
748
+ if (!this.isOpen) {
749
+ this.openPopup(ev);
750
+ }
751
+ }
752
+ },
753
+ onWrapperKeyDown: function onWrapperKeyDown(event) {
754
+ var _this = this;
755
+ var keyCode = event.keyCode,
756
+ altKey = event.altKey;
757
+ var treeviewElement = this.treeViewRef && this.treeViewRef.$el;
758
+ var inputElement = this.inputRef && this.inputRef.input;
759
+ if (this.$props.disabled || event.defaultPrevented && inputElement === event.target) {
760
+ return;
761
+ }
762
+ var ev = {
763
+ event: event,
764
+ target: this
765
+ };
766
+ if (this.value && this.value.length > 0 && (keyCode === kendo_vue_common_1.Keys.left || keyCode === kendo_vue_common_1.Keys.right || keyCode === kendo_vue_common_1.Keys.home || keyCode === kendo_vue_common_1.Keys.end || keyCode === kendo_vue_common_1.Keys.delete || keyCode === kendo_vue_common_1.Keys.backspace)) {
767
+ var tagsToRender = this.tagsToRenderRef;
768
+ var focusedIndex = this.focusedTagState ? tagsToRender.findIndex(function (t) {
769
+ return (0, utils_1.matchTags)(t, _this.focusedTagState, _this.dataItemKey);
770
+ }) : -1;
771
+ var newFocusedTag = undefined;
772
+ var hasFocused = focusedIndex !== -1;
773
+ if (keyCode === kendo_vue_common_1.Keys.left) {
774
+ if (hasFocused) {
775
+ focusedIndex = Math.max(0, focusedIndex - 1);
776
+ } else {
777
+ focusedIndex = tagsToRender.length - 1;
778
+ }
779
+ newFocusedTag = tagsToRender[focusedIndex];
780
+ } else if (keyCode === kendo_vue_common_1.Keys.right) {
781
+ if (focusedIndex === tagsToRender.length - 1) {
782
+ newFocusedTag = undefined;
783
+ } else if (hasFocused) {
784
+ focusedIndex = Math.min(tagsToRender.length - 1, focusedIndex + 1);
785
+ newFocusedTag = tagsToRender[focusedIndex];
786
+ }
787
+ } else if (keyCode === kendo_vue_common_1.Keys.home) {
788
+ newFocusedTag = tagsToRender[0];
789
+ } else if (keyCode === kendo_vue_common_1.Keys.end) {
790
+ newFocusedTag = tagsToRender[tagsToRender.length - 1];
791
+ } else if (keyCode === kendo_vue_common_1.Keys.delete || keyCode === kendo_vue_common_1.Keys.backspace) {
792
+ if (hasFocused) {
793
+ this.changeValue(ev, tagsToRender[focusedIndex].data, 'delete');
794
+ }
795
+ }
796
+ if (newFocusedTag !== this.focusedTagState) {
797
+ this.focusedTagState = newFocusedTag;
798
+ }
799
+ }
800
+ if (this.isOpen) {
801
+ if (keyCode === kendo_vue_common_1.Keys.esc || altKey && keyCode === kendo_vue_common_1.Keys.up) {
802
+ event.preventDefault();
803
+ this.switchFocus(function () {
804
+ _this.focusElement(_this.elementRef);
805
+ });
806
+ this.closePopup(ev);
807
+ } else if (treeviewElement && treeviewElement.querySelector('.k-focus') && (keyCode === kendo_vue_common_1.Keys.up || keyCode === kendo_vue_common_1.Keys.down || keyCode === kendo_vue_common_1.Keys.left || keyCode === kendo_vue_common_1.Keys.right || keyCode === kendo_vue_common_1.Keys.home || keyCode === kendo_vue_common_1.Keys.end)) {
808
+ if (keyCode === kendo_vue_common_1.Keys.up) {
809
+ var items = Array.from(treeviewElement.querySelectorAll('.k-treeview-item'));
810
+ var focusedItem = __spreadArray([], items, true).reverse().find(function (i) {
811
+ return Boolean(i && i.querySelector('.k-focus'));
812
+ });
813
+ if (focusedItem && items.indexOf(focusedItem) === 0) {
814
+ return this.switchFocus(function () {
815
+ _this.focusElement(inputElement || _this.elementRef);
816
+ });
817
+ }
818
+ }
819
+ this.switchFocus(kendo_vue_common_1.noop);
820
+ } else if (keyCode === kendo_vue_common_1.Keys.down) {
821
+ this.switchFocus(function () {
822
+ _this.focusElement(inputElement || treeviewElement);
823
+ });
824
+ }
825
+ } else {
826
+ if (altKey && keyCode === kendo_vue_common_1.Keys.down) {
827
+ event.preventDefault();
828
+ this.openPopup(ev);
829
+ }
830
+ }
831
+ },
832
+ onInputKeyDown: function onInputKeyDown(event) {
833
+ var _this = this;
834
+ var keyCode = event.keyCode,
835
+ altKey = event.altKey;
836
+ if (altKey || keyCode !== kendo_vue_common_1.Keys.up && keyCode !== kendo_vue_common_1.Keys.down) {
837
+ return;
838
+ }
839
+ event.preventDefault();
840
+ this.switchFocus(keyCode === kendo_vue_common_1.Keys.up ? function () {
841
+ _this.focusElement(_this.elementRef);
842
+ } : function () {
843
+ _this.focusElement(_this.treeViewRef && _this.treeViewRef.$el);
844
+ });
845
+ },
846
+ onClear: function onClear(event) {
847
+ var ev = {
848
+ event: event,
849
+ target: this
850
+ };
851
+ this.changeValue(ev, [], 'clear');
852
+ this.closePopup(ev);
853
+ event.preventDefault();
854
+ },
855
+ onTagDelete: function onTagDelete(itemsToRemove, event) {
856
+ this.closePopup({
857
+ target: this
858
+ });
859
+ if (!this.focusedState) {
860
+ var inputElement = this.inputRef && this.inputRef.input;
861
+ this.focusElement(inputElement);
862
+ }
863
+ this.changeValue({
864
+ event: event,
865
+ target: this
866
+ }, itemsToRemove, 'delete');
867
+ },
868
+ onExpand: function onExpand(e) {
869
+ var item = e.item,
870
+ itemHierarchicalIndex = e.itemHierarchicalIndex,
871
+ event = e.event;
872
+ var expandEvent = {
873
+ level: toLevel(itemHierarchicalIndex),
874
+ item: item,
875
+ event: event,
876
+ target: this
877
+ };
878
+ this.$emit('expandchange', expandEvent);
879
+ },
880
+ onFilterChange: function onFilterChange(event) {
881
+ var filterDesc = {
882
+ field: this.$props.textField,
883
+ operator: 'contains',
884
+ value: event.target.value
885
+ };
886
+ var ev = {
887
+ filter: filterDesc,
888
+ event: event,
889
+ target: this
890
+ };
891
+ this.$emit('filterchange', ev);
892
+ if (this.$props.filter === undefined) {
893
+ this.filterState = event.target.value;
894
+ }
895
+ }
896
+ }
897
+ };
898
+ exports.MultiSelectTreeVue2 = MultiSelectTreeVue2;
899
+ /**
900
+ * @hidden
901
+ */
902
+ var MultiSelectTree = MultiSelectTreeVue2;
903
+ exports.MultiSelectTree = MultiSelectTree;