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

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 (59) hide show
  1. package/dist/cdn/js/kendo-vue-dropdowns.js +1 -1
  2. package/dist/es/DropDownTree/DropDownTree.d.ts +1 -0
  3. package/dist/es/DropDownTree/DropDownTree.js +639 -0
  4. package/dist/es/DropDownTree/DropDownTreeProps.d.ts +278 -0
  5. package/dist/es/DropDownTree/DropDownTreeProps.js +2 -0
  6. package/dist/es/DropDownTree/ListNoData.d.ts +42 -0
  7. package/dist/es/DropDownTree/ListNoData.js +32 -0
  8. package/dist/es/DropDownTree/useDropdownWidth.d.ts +4 -0
  9. package/dist/es/DropDownTree/useDropdownWidth.js +10 -0
  10. package/dist/es/MultiSelectTree/MultiSelectTree.d.ts +48 -0
  11. package/dist/es/MultiSelectTree/MultiSelectTree.js +880 -0
  12. package/dist/es/MultiSelectTree/MultiSelectTreeProps.d.ts +306 -0
  13. package/dist/es/MultiSelectTree/MultiSelectTreeProps.js +2 -0
  14. package/dist/es/MultiSelectTree/utils.d.ts +17 -0
  15. package/dist/es/MultiSelectTree/utils.js +109 -0
  16. package/dist/es/common/utils.d.ts +6 -1
  17. package/dist/es/common/utils.js +10 -1
  18. package/dist/es/main.d.ts +5 -1
  19. package/dist/es/main.js +5 -1
  20. package/dist/es/package-metadata.js +1 -1
  21. package/dist/esm/DropDownTree/DropDownTree.d.ts +1 -0
  22. package/dist/esm/DropDownTree/DropDownTree.js +639 -0
  23. package/dist/esm/DropDownTree/DropDownTreeProps.d.ts +278 -0
  24. package/dist/esm/DropDownTree/DropDownTreeProps.js +2 -0
  25. package/dist/esm/DropDownTree/ListNoData.d.ts +42 -0
  26. package/dist/esm/DropDownTree/ListNoData.js +32 -0
  27. package/dist/esm/DropDownTree/useDropdownWidth.d.ts +4 -0
  28. package/dist/esm/DropDownTree/useDropdownWidth.js +10 -0
  29. package/dist/esm/MultiSelectTree/MultiSelectTree.d.ts +48 -0
  30. package/dist/esm/MultiSelectTree/MultiSelectTree.js +880 -0
  31. package/dist/esm/MultiSelectTree/MultiSelectTreeProps.d.ts +306 -0
  32. package/dist/esm/MultiSelectTree/MultiSelectTreeProps.js +2 -0
  33. package/dist/esm/MultiSelectTree/utils.d.ts +17 -0
  34. package/dist/esm/MultiSelectTree/utils.js +109 -0
  35. package/dist/esm/common/utils.d.ts +6 -1
  36. package/dist/esm/common/utils.js +10 -1
  37. package/dist/esm/main.d.ts +5 -1
  38. package/dist/esm/main.js +5 -1
  39. package/dist/esm/package-metadata.js +1 -1
  40. package/dist/npm/DropDownTree/DropDownTree.d.ts +1 -0
  41. package/dist/npm/DropDownTree/DropDownTree.js +640 -0
  42. package/dist/npm/DropDownTree/DropDownTreeProps.d.ts +278 -0
  43. package/dist/npm/DropDownTree/DropDownTreeProps.js +3 -0
  44. package/dist/npm/DropDownTree/ListNoData.d.ts +42 -0
  45. package/dist/npm/DropDownTree/ListNoData.js +39 -0
  46. package/dist/npm/DropDownTree/useDropdownWidth.d.ts +4 -0
  47. package/dist/npm/DropDownTree/useDropdownWidth.js +17 -0
  48. package/dist/npm/MultiSelectTree/MultiSelectTree.d.ts +48 -0
  49. package/dist/npm/MultiSelectTree/MultiSelectTree.js +887 -0
  50. package/dist/npm/MultiSelectTree/MultiSelectTreeProps.d.ts +306 -0
  51. package/dist/npm/MultiSelectTree/MultiSelectTreeProps.js +3 -0
  52. package/dist/npm/MultiSelectTree/utils.d.ts +17 -0
  53. package/dist/npm/MultiSelectTree/utils.js +114 -0
  54. package/dist/npm/common/utils.d.ts +6 -1
  55. package/dist/npm/common/utils.js +11 -1
  56. package/dist/npm/main.d.ts +5 -1
  57. package/dist/npm/main.js +20 -1
  58. package/dist/npm/package-metadata.js +1 -1
  59. package/package.json +12 -8
@@ -0,0 +1,887 @@
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 && placeholder]), !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
+ }, ["\xA0"])]), 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
+ },
464
+ onKeydown: _this2.onInputKeyDown,
465
+ size: size,
466
+ rounded: rounded,
467
+ fillMode: fillMode
468
+ }), header && h("div", {
469
+ "class": "k-list-header"
470
+ }, [header]), dataItems.length > 0 ?
471
+ // @ts-ignore
472
+ h(kendo_vue_treeview_1.TreeView, {
473
+ ref: (0, kendo_vue_common_1.setRef)(_this2, 'treeView'),
474
+ tabIndex: tabIndex,
475
+ attrs: _this2.v3 ? undefined : {
476
+ tabIndex: tabIndex,
477
+ dataItems: dataItems,
478
+ focusIdField: dataItemKey,
479
+ textField: _this2.$props.textField,
480
+ checkField: checkField,
481
+ checkIndeterminateField: checkIndeterminateField,
482
+ expandField: _this2.$props.expandField,
483
+ childrenField: subItemsField,
484
+ expandIcons: true,
485
+ checkboxes: true,
486
+ size: size,
487
+ item: itemTemplate
488
+ },
489
+ dataItems: dataItems,
490
+ focusIdField: dataItemKey,
491
+ textField: _this2.$props.textField,
492
+ checkField: checkField,
493
+ checkIndeterminateField: checkIndeterminateField,
494
+ expandField: _this2.$props.expandField,
495
+ childrenField: subItemsField,
496
+ expandIcons: true,
497
+ onItemclick: _this2.onChange,
498
+ on: _this2.v3 ? undefined : {
499
+ "itemclick": _this2.onChange,
500
+ "checkchange": _this2.onChange,
501
+ "expandchange": _this2.onExpand,
502
+ "blur": _this2.onBlur,
503
+ "keydown": _this2.onWrapperKeyDown
504
+ },
505
+ onCheckchange: _this2.onChange,
506
+ onExpandchange: _this2.onExpand,
507
+ onBlur: _this2.onBlur,
508
+ onKeydown: _this2.onWrapperKeyDown,
509
+ checkboxes: true,
510
+ size: size,
511
+ item: itemTemplate
512
+ }) : noDataTemplate, footer && h("div", {
513
+ "class": "k-list-footer"
514
+ }, [footer])];
515
+ } : [_this2.$props.filterable && h(ListFilter_1.ListFilter, {
516
+ value: _this2.$props.filter === undefined ? _this2.filterState : _this2.$props.filter,
517
+ attrs: _this2.v3 ? undefined : {
518
+ value: _this2.$props.filter === undefined ? _this2.filterState : _this2.$props.filter,
519
+ size: size,
520
+ rounded: rounded,
521
+ fillMode: fillMode
522
+ },
523
+ ref: (0, kendo_vue_common_1.setRef)(_this2, 'input'),
524
+ onChange: _this2.onFilterChange,
525
+ on: _this2.v3 ? undefined : {
526
+ "change": _this2.onFilterChange,
527
+ "keydown": _this2.onInputKeyDown
528
+ },
529
+ onKeydown: _this2.onInputKeyDown,
530
+ size: size,
531
+ rounded: rounded,
532
+ fillMode: fillMode
533
+ }), header && h("div", {
534
+ "class": "k-list-header"
535
+ }, [header]), dataItems.length > 0 ? h(kendo_vue_treeview_1.TreeView, {
536
+ ref: (0, kendo_vue_common_1.setRef)(_this2, 'treeView'),
537
+ tabIndex: tabIndex,
538
+ attrs: _this2.v3 ? undefined : {
539
+ tabIndex: tabIndex,
540
+ dataItems: dataItems,
541
+ focusIdField: dataItemKey,
542
+ textField: _this2.$props.textField,
543
+ checkField: checkField,
544
+ checkIndeterminateField: checkIndeterminateField,
545
+ expandField: _this2.$props.expandField,
546
+ childrenField: subItemsField,
547
+ expandIcons: true,
548
+ checkboxes: true,
549
+ size: size,
550
+ item: itemTemplate
551
+ },
552
+ dataItems: dataItems,
553
+ focusIdField: dataItemKey,
554
+ textField: _this2.$props.textField,
555
+ checkField: checkField,
556
+ checkIndeterminateField: checkIndeterminateField,
557
+ expandField: _this2.$props.expandField,
558
+ childrenField: subItemsField,
559
+ expandIcons: true,
560
+ onItemclick: _this2.onChange,
561
+ on: _this2.v3 ? undefined : {
562
+ "itemclick": _this2.onChange,
563
+ "checkchange": _this2.onChange,
564
+ "expandchange": _this2.onExpand,
565
+ "blur": _this2.onBlur,
566
+ "keydown": _this2.onWrapperKeyDown
567
+ },
568
+ onCheckchange: _this2.onChange,
569
+ onExpandchange: _this2.onExpand,
570
+ onBlur: _this2.onBlur,
571
+ onKeydown: _this2.onWrapperKeyDown,
572
+ checkboxes: true,
573
+ size: size,
574
+ item: itemTemplate
575
+ }) : noDataTemplate, footer && h("div", {
576
+ "class": "k-list-footer"
577
+ }, [footer])])]);
578
+ return label ?
579
+ // @ts-ignore function children
580
+ h(kendo_vue_labels_1.FloatingLabel, {
581
+ label: label,
582
+ attrs: this.v3 ? undefined : {
583
+ label: label,
584
+ editorValue: this.hasValue,
585
+ editorPlaceholder: placeholder,
586
+ editorValid: isValid,
587
+ editorDisabled: disabled,
588
+ editorId: id,
589
+ dir: dir
590
+ },
591
+ editorValue: this.hasValue,
592
+ editorPlaceholder: placeholder,
593
+ editorValid: isValid,
594
+ editorDisabled: disabled,
595
+ editorId: id,
596
+ dir: dir
597
+ }, this.v3 ? function () {
598
+ return [multiselecttree];
599
+ } : [multiselecttree]) : multiselecttree;
600
+ },
601
+ methods: {
602
+ calculatePopupWidth: function calculatePopupWidth() {
603
+ if (this.elementRef) {
604
+ this.popupWidth = this.popupSettings.width !== undefined ? this.popupSettings.width : this.elementRef.offsetWidth + 'px';
605
+ }
606
+ },
607
+ focus: function focus() {
608
+ if (this.$el) {
609
+ this.$el.focus();
610
+ }
611
+ },
612
+ setValidity: function setValidity() {
613
+ if (this.selectRef && this.selectRef.setCustomValidity) {
614
+ var _a = this.$props,
615
+ validationMessage = _a.validationMessage,
616
+ valid = _a.valid,
617
+ required = _a.required;
618
+ var validity = getValidity({
619
+ validationMessage: validationMessage,
620
+ valid: valid,
621
+ required: required
622
+ }, this.hasValue);
623
+ this.selectRef.setCustomValidity(validity.valid ? '' : this.validationMessage === undefined ? VALIDATION_MESSAGE : this.validationMessage);
624
+ }
625
+ },
626
+ changeValue: function changeValue(event, relatedItems, operation) {
627
+ var changeEvent = __assign({
628
+ items: relatedItems,
629
+ operation: operation
630
+ }, event);
631
+ this.$emit('change', changeEvent);
632
+ },
633
+ onChange: function onChange(e) {
634
+ if ((0, utils_1.areSame)(e.item, this.computedValue, this.dataItemKey)) {
635
+ return;
636
+ }
637
+ var item = e.item,
638
+ event = e.event;
639
+ var ev = {
640
+ event: event,
641
+ target: this
642
+ };
643
+ this.changeValue(ev, [item], 'toggle');
644
+ },
645
+ openPopup: function openPopup(event) {
646
+ if (!this.isOpen) {
647
+ var openEvent = __assign({}, event);
648
+ this.$emit('open', openEvent);
649
+ if (this.opened === undefined) {
650
+ this.openState = true;
651
+ }
652
+ }
653
+ },
654
+ closePopup: function closePopup(event) {
655
+ if (this.isOpen) {
656
+ var closeEvent = __assign({}, event);
657
+ this.$emit('close', closeEvent);
658
+ if (this.opened === undefined) {
659
+ this.openState = false;
660
+ }
661
+ }
662
+ },
663
+ switchFocus: function switchFocus(focusFn) {
664
+ var _this = this;
665
+ this.skipFocusRef = true;
666
+ focusFn();
667
+ window.setTimeout(function () {
668
+ return _this.skipFocusRef = false;
669
+ }, 0);
670
+ },
671
+ focusElement: function focusElement(element) {
672
+ if (element) {
673
+ this.switchFocus(function () {
674
+ return element.focus();
675
+ });
676
+ }
677
+ },
678
+ onPopupOpened: function onPopupOpened() {
679
+ if (!this.focusedState && this.isOpen) {
680
+ this.closePopup({
681
+ target: this
682
+ });
683
+ } else {
684
+ if (this.$props.filterable) {
685
+ var inputElement = this.inputRef && this.inputRef.input;
686
+ this.focusElement(inputElement);
687
+ } else {
688
+ this.focusElement(this.treeViewRef && this.treeViewRef.input);
689
+ }
690
+ }
691
+ },
692
+ onPopupClosed: function onPopupClosed() {
693
+ if (this.focusedState) {
694
+ // Move the focus from treeview to dropdown without triggering Focus or Blur events.
695
+ this.focusElement(this.$el);
696
+ }
697
+ },
698
+ onFocus: function onFocus(event) {
699
+ if (!this.focusedState && !this.skipFocusRef) {
700
+ this.focusedState = true;
701
+ var focusEvent = {
702
+ event: event,
703
+ target: this
704
+ };
705
+ this.$emit('focus', focusEvent);
706
+ }
707
+ },
708
+ onBlur: function onBlur(event) {
709
+ if (this.focusedState && !this.skipFocusRef) {
710
+ this.focusedState = false;
711
+ var ev = {
712
+ event: event,
713
+ target: this
714
+ };
715
+ var focusEvent = __assign({}, ev);
716
+ if (!event.relatedTarget || !event.relatedTarget.closest('.popup-' + this.componentGuid)) {
717
+ this.$emit('blur', focusEvent);
718
+ this.closePopup(ev);
719
+ }
720
+ }
721
+ },
722
+ onWrapperMouseDown: function onWrapperMouseDown() {
723
+ if (this.focusedState) {
724
+ // moving focus from treeview to dropdown triggers Focus and Blur events.
725
+ this.switchFocus(kendo_vue_common_1.noop);
726
+ }
727
+ },
728
+ onWrapperClick: function onWrapperClick(event) {
729
+ if (!this.$props.disabled && !event.defaultPrevented) {
730
+ this.focusedState = true;
731
+ var ev = {
732
+ event: event,
733
+ target: this
734
+ };
735
+ if (!this.isOpen) {
736
+ this.openPopup(ev);
737
+ }
738
+ }
739
+ },
740
+ onWrapperKeyDown: function onWrapperKeyDown(event) {
741
+ var _this = this;
742
+ var keyCode = event.keyCode,
743
+ altKey = event.altKey;
744
+ var treeviewElement = this.treeViewRef && this.treeViewRef.$el;
745
+ var inputElement = this.inputRef && this.inputRef.input;
746
+ if (this.$props.disabled || event.defaultPrevented && inputElement === event.target) {
747
+ return;
748
+ }
749
+ var ev = {
750
+ event: event,
751
+ target: this
752
+ };
753
+ 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)) {
754
+ var tagsToRender = this.tagsToRenderRef;
755
+ var focusedIndex = this.focusedTagState ? tagsToRender.findIndex(function (t) {
756
+ return (0, utils_1.matchTags)(t, _this.focusedTagState, _this.dataItemKey);
757
+ }) : -1;
758
+ var newFocusedTag = undefined;
759
+ var hasFocused = focusedIndex !== -1;
760
+ if (keyCode === kendo_vue_common_1.Keys.left) {
761
+ if (hasFocused) {
762
+ focusedIndex = Math.max(0, focusedIndex - 1);
763
+ } else {
764
+ focusedIndex = tagsToRender.length - 1;
765
+ }
766
+ newFocusedTag = tagsToRender[focusedIndex];
767
+ } else if (keyCode === kendo_vue_common_1.Keys.right) {
768
+ if (focusedIndex === tagsToRender.length - 1) {
769
+ newFocusedTag = undefined;
770
+ } else if (hasFocused) {
771
+ focusedIndex = Math.min(tagsToRender.length - 1, focusedIndex + 1);
772
+ newFocusedTag = tagsToRender[focusedIndex];
773
+ }
774
+ } else if (keyCode === kendo_vue_common_1.Keys.home) {
775
+ newFocusedTag = tagsToRender[0];
776
+ } else if (keyCode === kendo_vue_common_1.Keys.end) {
777
+ newFocusedTag = tagsToRender[tagsToRender.length - 1];
778
+ } else if (keyCode === kendo_vue_common_1.Keys.delete) {
779
+ if (hasFocused) {
780
+ this.changeValue(ev, tagsToRender[focusedIndex].data, 'delete');
781
+ }
782
+ }
783
+ if (newFocusedTag !== this.focusedTagState) {
784
+ this.focusedTagState = newFocusedTag;
785
+ }
786
+ }
787
+ if (this.isOpen) {
788
+ if (keyCode === kendo_vue_common_1.Keys.esc || altKey && keyCode === kendo_vue_common_1.Keys.up) {
789
+ event.preventDefault();
790
+ this.closePopup(ev);
791
+ } 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)) {
792
+ if (keyCode === kendo_vue_common_1.Keys.up) {
793
+ var items = Array.from(treeviewElement.querySelectorAll('.k-treeview-item'));
794
+ var focusedItem = __spreadArray([], items, true).reverse().find(function (i) {
795
+ return Boolean(i && i.querySelector('.k-focus'));
796
+ });
797
+ if (focusedItem && items.indexOf(focusedItem) === 0) {
798
+ return this.switchFocus(function () {
799
+ _this.focusElement(inputElement || _this.elementRef);
800
+ });
801
+ }
802
+ }
803
+ this.switchFocus(kendo_vue_common_1.noop);
804
+ } else if (keyCode === kendo_vue_common_1.Keys.down) {
805
+ this.switchFocus(function () {
806
+ _this.focusElement(inputElement || treeviewElement);
807
+ });
808
+ }
809
+ } else {
810
+ if (altKey && keyCode === kendo_vue_common_1.Keys.down) {
811
+ event.preventDefault();
812
+ this.openPopup(ev);
813
+ }
814
+ }
815
+ },
816
+ onInputKeyDown: function onInputKeyDown(event) {
817
+ var _this = this;
818
+ var keyCode = event.keyCode,
819
+ altKey = event.altKey;
820
+ if (altKey || keyCode !== kendo_vue_common_1.Keys.up && keyCode !== kendo_vue_common_1.Keys.down) {
821
+ return;
822
+ }
823
+ event.preventDefault();
824
+ this.switchFocus(keyCode === kendo_vue_common_1.Keys.up ? function () {
825
+ _this.focusElement(_this.$el);
826
+ } : function () {
827
+ _this.focusElement(_this.treeViewRef && _this.treeViewRef.$el);
828
+ });
829
+ },
830
+ onClear: function onClear(event) {
831
+ var ev = {
832
+ event: event,
833
+ target: this
834
+ };
835
+ this.changeValue(ev, [], 'clear');
836
+ this.closePopup(ev);
837
+ event.preventDefault();
838
+ },
839
+ onTagDelete: function onTagDelete(itemsToRemove, event) {
840
+ this.closePopup({
841
+ target: this
842
+ });
843
+ if (!this.focusedState) {
844
+ var inputElement = this.inputRef && this.inputRef.input;
845
+ this.focusElement(inputElement);
846
+ }
847
+ this.changeValue({
848
+ event: event,
849
+ target: this
850
+ }, itemsToRemove, 'delete');
851
+ },
852
+ onExpand: function onExpand(e) {
853
+ var item = e.item,
854
+ itemHierarchicalIndex = e.itemHierarchicalIndex,
855
+ event = e.event;
856
+ var expandEvent = {
857
+ level: toLevel(itemHierarchicalIndex),
858
+ item: item,
859
+ event: event,
860
+ target: this
861
+ };
862
+ this.$emit('expandchange', expandEvent);
863
+ },
864
+ onFilterChange: function onFilterChange(event) {
865
+ var filterDesc = {
866
+ field: this.$props.textField,
867
+ operator: 'contains',
868
+ value: event.target.value
869
+ };
870
+ var ev = {
871
+ filter: filterDesc,
872
+ event: event,
873
+ target: this
874
+ };
875
+ this.$emit('filterchange', ev);
876
+ if (this.$props.filter === undefined) {
877
+ this.filterState = event.target.value;
878
+ }
879
+ }
880
+ }
881
+ };
882
+ exports.MultiSelectTreeVue2 = MultiSelectTreeVue2;
883
+ /**
884
+ * @hidden
885
+ */
886
+ var MultiSelectTree = MultiSelectTreeVue2;
887
+ exports.MultiSelectTree = MultiSelectTree;