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