@progress/kendo-vue-dropdowns 3.9.4-dev.202304190945 → 3.9.4-dev.202304241333
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/js/kendo-vue-dropdowns.js +1 -1
- package/dist/es/ComboBox/ComboBox.js +3 -1
- package/dist/es/DropDownTree/DropDownTreeProps.d.ts +2 -2
- package/dist/es/MultiSelectTree/MultiSelectTree.js +65 -21
- package/dist/es/MultiSelectTree/MultiSelectTreeProps.d.ts +11 -3
- package/dist/es/common/ListFilter.js +15 -3
- package/dist/es/package-metadata.js +1 -1
- package/dist/esm/ComboBox/ComboBox.js +3 -1
- package/dist/esm/DropDownTree/DropDownTreeProps.d.ts +2 -2
- package/dist/esm/MultiSelectTree/MultiSelectTree.js +65 -21
- package/dist/esm/MultiSelectTree/MultiSelectTreeProps.d.ts +11 -3
- package/dist/esm/common/ListFilter.js +15 -3
- package/dist/esm/package-metadata.js +1 -1
- package/dist/npm/ComboBox/ComboBox.js +3 -1
- package/dist/npm/DropDownTree/DropDownTreeProps.d.ts +2 -2
- package/dist/npm/MultiSelectTree/MultiSelectTree.js +65 -21
- package/dist/npm/MultiSelectTree/MultiSelectTreeProps.d.ts +11 -3
- package/dist/npm/common/ListFilter.js +15 -3
- package/dist/npm/package-metadata.js +1 -1
- package/package.json +8 -8
|
@@ -269,10 +269,12 @@ var ComboBoxVue2 = {
|
|
|
269
269
|
this.base.scrollToVirtualItem(virtual, selectedItemIndex);
|
|
270
270
|
this.prevCurrentOpened = true;
|
|
271
271
|
} else if (opening && !virtual) {
|
|
272
|
-
this.base.scrollToItem(selectedItemIndex);
|
|
272
|
+
this.base.scrollToItem(selectedItem ? selectedItemIndex : this.getFocusedIndex());
|
|
273
273
|
this.prevCurrentOpened = true;
|
|
274
274
|
} else if (opened && prevOpened && selectedItem && selectedItemChanged) {
|
|
275
275
|
this.base.scrollToItem(selectedItemIndex);
|
|
276
|
+
} else if (opened && !selectedItem) {
|
|
277
|
+
this.base.scrollToItem(this.getFocusedIndex());
|
|
276
278
|
}
|
|
277
279
|
}
|
|
278
280
|
if (opening && this.input) {
|
|
@@ -135,7 +135,7 @@ export interface DropDownTreeProps extends FormComponentProps {
|
|
|
135
135
|
filterable?: boolean;
|
|
136
136
|
/**
|
|
137
137
|
* Sets the value of filtering input.
|
|
138
|
-
* Useful for making the filtering input a
|
|
138
|
+
* Useful for making the filtering input a controlled component.
|
|
139
139
|
*/
|
|
140
140
|
filter?: string;
|
|
141
141
|
/**
|
|
@@ -172,7 +172,7 @@ export interface DropDownTreeProps extends FormComponentProps {
|
|
|
172
172
|
*/
|
|
173
173
|
popupSettings?: DropDownsPopupSettings;
|
|
174
174
|
/**
|
|
175
|
-
* Represents a callback function, which returns the value for submitting. The returned value will be rendered in an `option` of a hidden
|
|
175
|
+
* Represents a callback function, which returns the value for submitting. The returned value will be rendered in an `option` of a hidden `select`.
|
|
176
176
|
*
|
|
177
177
|
* @example
|
|
178
178
|
* ```jsx-no-run
|
|
@@ -36,6 +36,7 @@ import { FloatingLabel } from '@progress/kendo-vue-labels';
|
|
|
36
36
|
import { TagList } from '../MultiSelect/TagList';
|
|
37
37
|
import { ClearButton } from '../common/ClearButton';
|
|
38
38
|
import { ListFilter } from '../common/ListFilter';
|
|
39
|
+
import { getMultiSelectTreeValue } from './utils';
|
|
39
40
|
var VALIDATION_MESSAGE = 'Please select a value from the list!';
|
|
40
41
|
var sizeMap = kendoThemeMaps.sizeMap,
|
|
41
42
|
roundedMap = kendoThemeMaps.roundedMap;
|
|
@@ -59,6 +60,9 @@ var getValidity = function getValidity(parameters, hasValue) {
|
|
|
59
60
|
*/
|
|
60
61
|
var MultiSelectTreeVue2 = {
|
|
61
62
|
name: 'KendoMultiSelectTree',
|
|
63
|
+
model: {
|
|
64
|
+
event: 'changemodel'
|
|
65
|
+
},
|
|
62
66
|
// @ts-ignore
|
|
63
67
|
emits: {
|
|
64
68
|
open: null,
|
|
@@ -67,7 +71,9 @@ var MultiSelectTreeVue2 = {
|
|
|
67
71
|
blur: null,
|
|
68
72
|
change: null,
|
|
69
73
|
filterChange: null,
|
|
70
|
-
expandChange: null
|
|
74
|
+
expandChange: null,
|
|
75
|
+
'changemodel': null,
|
|
76
|
+
'update:modelValue': null
|
|
71
77
|
},
|
|
72
78
|
props: {
|
|
73
79
|
opened: {
|
|
@@ -85,6 +91,7 @@ var MultiSelectTreeVue2 = {
|
|
|
85
91
|
}
|
|
86
92
|
},
|
|
87
93
|
value: Array,
|
|
94
|
+
modelValue: Array,
|
|
88
95
|
valueMap: Function,
|
|
89
96
|
placeholder: String,
|
|
90
97
|
dataItemKey: {
|
|
@@ -117,7 +124,7 @@ var MultiSelectTreeVue2 = {
|
|
|
117
124
|
},
|
|
118
125
|
valid: {
|
|
119
126
|
type: Boolean,
|
|
120
|
-
default:
|
|
127
|
+
default: undefined
|
|
121
128
|
},
|
|
122
129
|
required: Boolean,
|
|
123
130
|
name: String,
|
|
@@ -189,7 +196,7 @@ var MultiSelectTreeVue2 = {
|
|
|
189
196
|
return this.opened !== undefined ? this.opened : this.openState;
|
|
190
197
|
},
|
|
191
198
|
computedValue: function computedValue() {
|
|
192
|
-
return this.value !== undefined ? this.value : this.currentValue;
|
|
199
|
+
return this.value !== undefined ? this.value : this.$props.modelValue !== undefined ? this.$props.modelValue : this.currentValue;
|
|
193
200
|
},
|
|
194
201
|
hasValue: function hasValue() {
|
|
195
202
|
return !!this.computedValue.length;
|
|
@@ -314,13 +321,13 @@ var MultiSelectTreeVue2 = {
|
|
|
314
321
|
on: this.v3 ? undefined : {
|
|
315
322
|
"keydown": this.onWrapperKeyDown,
|
|
316
323
|
"mousedown": this.onWrapperMouseDown,
|
|
317
|
-
"
|
|
318
|
-
"
|
|
324
|
+
"focusin": this.onFocus,
|
|
325
|
+
"focusout": this.onBlur,
|
|
319
326
|
"click": this.onWrapperClick
|
|
320
327
|
},
|
|
321
328
|
onMousedown: this.onWrapperMouseDown,
|
|
322
|
-
|
|
323
|
-
|
|
329
|
+
onFocusin: this.onFocus,
|
|
330
|
+
onFocusout: this.onBlur,
|
|
324
331
|
role: "combobox",
|
|
325
332
|
"aria-haspopup": "true",
|
|
326
333
|
"aria-expanded": this.isOpen,
|
|
@@ -345,7 +352,9 @@ var MultiSelectTreeVue2 = {
|
|
|
345
352
|
focused: this.focusedTagState ? this.tagsToRenderRef.find(function (t) {
|
|
346
353
|
return matchTags(t, _this.focusedTagState, dataItemKey);
|
|
347
354
|
}) : undefined,
|
|
348
|
-
|
|
355
|
+
tagsRounded: rounded,
|
|
356
|
+
size: size,
|
|
357
|
+
fillMode: fillMode
|
|
349
358
|
},
|
|
350
359
|
onTagdelete: this.onTagDelete,
|
|
351
360
|
on: this.v3 ? undefined : {
|
|
@@ -356,8 +365,10 @@ var MultiSelectTreeVue2 = {
|
|
|
356
365
|
focused: this.focusedTagState ? this.tagsToRenderRef.find(function (t) {
|
|
357
366
|
return matchTags(t, _this.focusedTagState, dataItemKey);
|
|
358
367
|
}) : undefined,
|
|
359
|
-
|
|
360
|
-
|
|
368
|
+
tagsRounded: rounded,
|
|
369
|
+
size: size,
|
|
370
|
+
fillMode: fillMode
|
|
371
|
+
}) : !this.hasValue && h("span", {
|
|
361
372
|
"class": "k-input-inner",
|
|
362
373
|
role: 'combobox',
|
|
363
374
|
attrs: this.v3 ? undefined : {
|
|
@@ -373,7 +384,7 @@ var MultiSelectTreeVue2 = {
|
|
|
373
384
|
"aria-label": this.$props.ariaLabelledBy
|
|
374
385
|
}, [h("span", {
|
|
375
386
|
"class": "k-input-value-text"
|
|
376
|
-
}, [
|
|
387
|
+
}, [placeholder])])]), this.$props.loading && h(Icon, {
|
|
377
388
|
"class": "k-input-loading-icon",
|
|
378
389
|
name: "loading",
|
|
379
390
|
attrs: this.v3 ? undefined : {
|
|
@@ -390,11 +401,13 @@ var MultiSelectTreeVue2 = {
|
|
|
390
401
|
name: name,
|
|
391
402
|
tabIndex: -1,
|
|
392
403
|
"aria-hidden": true,
|
|
404
|
+
required: required,
|
|
393
405
|
title: label
|
|
394
406
|
},
|
|
395
407
|
ref: setRef(this, 'select'),
|
|
396
408
|
tabIndex: -1,
|
|
397
409
|
"aria-hidden": true,
|
|
410
|
+
required: required,
|
|
398
411
|
title: label,
|
|
399
412
|
style: {
|
|
400
413
|
opacity: 0,
|
|
@@ -453,12 +466,16 @@ var MultiSelectTreeVue2 = {
|
|
|
453
466
|
onChange: _this2.onFilterChange,
|
|
454
467
|
on: _this2.v3 ? undefined : {
|
|
455
468
|
"change": _this2.onFilterChange,
|
|
456
|
-
"keydown": _this2.onInputKeyDown
|
|
469
|
+
"keydown": _this2.onInputKeyDown,
|
|
470
|
+
"focus": _this2.onFocus,
|
|
471
|
+
"blur": _this2.onBlur
|
|
457
472
|
},
|
|
458
473
|
onKeydown: _this2.onInputKeyDown,
|
|
459
474
|
size: size,
|
|
460
475
|
rounded: rounded,
|
|
461
|
-
fillMode: fillMode
|
|
476
|
+
fillMode: fillMode,
|
|
477
|
+
onFocus: _this2.onFocus,
|
|
478
|
+
onBlur: _this2.onBlur
|
|
462
479
|
}), header && h("div", {
|
|
463
480
|
"class": "k-list-header"
|
|
464
481
|
}, [header]), dataItems.length > 0 ?
|
|
@@ -493,11 +510,13 @@ var MultiSelectTreeVue2 = {
|
|
|
493
510
|
"itemclick": _this2.onChange,
|
|
494
511
|
"checkchange": _this2.onChange,
|
|
495
512
|
"expandchange": _this2.onExpand,
|
|
513
|
+
"focus": _this2.onFocus,
|
|
496
514
|
"blur": _this2.onBlur,
|
|
497
515
|
"keydown": _this2.onWrapperKeyDown
|
|
498
516
|
},
|
|
499
517
|
onCheckchange: _this2.onChange,
|
|
500
518
|
onExpandchange: _this2.onExpand,
|
|
519
|
+
onFocus: _this2.onFocus,
|
|
501
520
|
onBlur: _this2.onBlur,
|
|
502
521
|
onKeydown: _this2.onWrapperKeyDown,
|
|
503
522
|
checkboxes: true,
|
|
@@ -518,12 +537,16 @@ var MultiSelectTreeVue2 = {
|
|
|
518
537
|
onChange: _this2.onFilterChange,
|
|
519
538
|
on: _this2.v3 ? undefined : {
|
|
520
539
|
"change": _this2.onFilterChange,
|
|
521
|
-
"keydown": _this2.onInputKeyDown
|
|
540
|
+
"keydown": _this2.onInputKeyDown,
|
|
541
|
+
"focus": _this2.onFocus,
|
|
542
|
+
"blur": _this2.onBlur
|
|
522
543
|
},
|
|
523
544
|
onKeydown: _this2.onInputKeyDown,
|
|
524
545
|
size: size,
|
|
525
546
|
rounded: rounded,
|
|
526
|
-
fillMode: fillMode
|
|
547
|
+
fillMode: fillMode,
|
|
548
|
+
onFocus: _this2.onFocus,
|
|
549
|
+
onBlur: _this2.onBlur
|
|
527
550
|
}), header && h("div", {
|
|
528
551
|
"class": "k-list-header"
|
|
529
552
|
}, [header]), dataItems.length > 0 ? h(TreeView, {
|
|
@@ -556,11 +579,13 @@ var MultiSelectTreeVue2 = {
|
|
|
556
579
|
"itemclick": _this2.onChange,
|
|
557
580
|
"checkchange": _this2.onChange,
|
|
558
581
|
"expandchange": _this2.onExpand,
|
|
582
|
+
"focus": _this2.onFocus,
|
|
559
583
|
"blur": _this2.onBlur,
|
|
560
584
|
"keydown": _this2.onWrapperKeyDown
|
|
561
585
|
},
|
|
562
586
|
onCheckchange: _this2.onChange,
|
|
563
587
|
onExpandchange: _this2.onExpand,
|
|
588
|
+
onFocus: _this2.onFocus,
|
|
564
589
|
onBlur: _this2.onBlur,
|
|
565
590
|
onKeydown: _this2.onWrapperKeyDown,
|
|
566
591
|
checkboxes: true,
|
|
@@ -617,11 +642,26 @@ var MultiSelectTreeVue2 = {
|
|
|
617
642
|
this.selectRef.setCustomValidity(validity.valid ? '' : this.validationMessage === undefined ? VALIDATION_MESSAGE : this.validationMessage);
|
|
618
643
|
}
|
|
619
644
|
},
|
|
620
|
-
changeValue: function changeValue(event,
|
|
645
|
+
changeValue: function changeValue(event, items, operation) {
|
|
646
|
+
var fields = {
|
|
647
|
+
dataItemKey: this.dataItemKey,
|
|
648
|
+
checkField: this.checkField,
|
|
649
|
+
checkIndeterminateField: this.checkIndeterminateField,
|
|
650
|
+
expandField: this.expandField,
|
|
651
|
+
subItemsField: this.subItemsField
|
|
652
|
+
};
|
|
653
|
+
var value = getMultiSelectTreeValue(this.dataItems, __assign(__assign({}, fields), {
|
|
654
|
+
items: items,
|
|
655
|
+
operation: operation,
|
|
656
|
+
value: this.value
|
|
657
|
+
}));
|
|
621
658
|
var changeEvent = __assign({
|
|
622
|
-
items:
|
|
623
|
-
operation: operation
|
|
659
|
+
items: items,
|
|
660
|
+
operation: operation,
|
|
661
|
+
value: value
|
|
624
662
|
}, event);
|
|
663
|
+
this.$emit('changemodel', value);
|
|
664
|
+
this.$emit('update:modelValue', value);
|
|
625
665
|
this.$emit('change', changeEvent);
|
|
626
666
|
},
|
|
627
667
|
onChange: function onChange(e) {
|
|
@@ -701,6 +741,7 @@ var MultiSelectTreeVue2 = {
|
|
|
701
741
|
},
|
|
702
742
|
onBlur: function onBlur(event) {
|
|
703
743
|
if (this.focusedState && !this.skipFocusRef) {
|
|
744
|
+
this.focusedTagState = undefined;
|
|
704
745
|
this.focusedState = false;
|
|
705
746
|
var ev = {
|
|
706
747
|
event: event,
|
|
@@ -744,7 +785,7 @@ var MultiSelectTreeVue2 = {
|
|
|
744
785
|
event: event,
|
|
745
786
|
target: this
|
|
746
787
|
};
|
|
747
|
-
if (this.value && this.value.length > 0 && (keyCode === Keys.left || keyCode === Keys.right || keyCode === Keys.home || keyCode === Keys.end || keyCode === Keys.delete)) {
|
|
788
|
+
if (this.value && this.value.length > 0 && (keyCode === Keys.left || keyCode === Keys.right || keyCode === Keys.home || keyCode === Keys.end || keyCode === Keys.delete || keyCode === Keys.backspace)) {
|
|
748
789
|
var tagsToRender = this.tagsToRenderRef;
|
|
749
790
|
var focusedIndex = this.focusedTagState ? tagsToRender.findIndex(function (t) {
|
|
750
791
|
return matchTags(t, _this.focusedTagState, _this.dataItemKey);
|
|
@@ -769,7 +810,7 @@ var MultiSelectTreeVue2 = {
|
|
|
769
810
|
newFocusedTag = tagsToRender[0];
|
|
770
811
|
} else if (keyCode === Keys.end) {
|
|
771
812
|
newFocusedTag = tagsToRender[tagsToRender.length - 1];
|
|
772
|
-
} else if (keyCode === Keys.delete) {
|
|
813
|
+
} else if (keyCode === Keys.delete || keyCode === Keys.backspace) {
|
|
773
814
|
if (hasFocused) {
|
|
774
815
|
this.changeValue(ev, tagsToRender[focusedIndex].data, 'delete');
|
|
775
816
|
}
|
|
@@ -781,6 +822,9 @@ var MultiSelectTreeVue2 = {
|
|
|
781
822
|
if (this.isOpen) {
|
|
782
823
|
if (keyCode === Keys.esc || altKey && keyCode === Keys.up) {
|
|
783
824
|
event.preventDefault();
|
|
825
|
+
this.switchFocus(function () {
|
|
826
|
+
_this.focusElement(_this.elementRef);
|
|
827
|
+
});
|
|
784
828
|
this.closePopup(ev);
|
|
785
829
|
} 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
830
|
if (keyCode === Keys.up) {
|
|
@@ -816,7 +860,7 @@ var MultiSelectTreeVue2 = {
|
|
|
816
860
|
}
|
|
817
861
|
event.preventDefault();
|
|
818
862
|
this.switchFocus(keyCode === Keys.up ? function () {
|
|
819
|
-
_this.focusElement(_this
|
|
863
|
+
_this.focusElement(_this.elementRef);
|
|
820
864
|
} : function () {
|
|
821
865
|
_this.focusElement(_this.treeViewRef && _this.treeViewRef.$el);
|
|
822
866
|
});
|
|
@@ -17,6 +17,10 @@ export interface MultiSelectTreeChangeEvent extends DropdownEvent {
|
|
|
17
17
|
* The items related to current operation.
|
|
18
18
|
*/
|
|
19
19
|
items: any[];
|
|
20
|
+
/**
|
|
21
|
+
* The new value.
|
|
22
|
+
*/
|
|
23
|
+
value: any[];
|
|
20
24
|
/**
|
|
21
25
|
* Describes the current operation:
|
|
22
26
|
* * `clear` - clear button is clicked and value is cleared. Null value is returned.
|
|
@@ -85,9 +89,13 @@ export interface MultiSelectTreeProps extends FormComponentProps {
|
|
|
85
89
|
*/
|
|
86
90
|
opened?: boolean;
|
|
87
91
|
/**
|
|
88
|
-
* Sets the value of the MultiSelectTree. It can either be of the primitive (string, numbers) or of the complex (objects) type.
|
|
92
|
+
* Sets the value of the MultiSelectTree. It can either be an array of the primitive (string, numbers) or of the complex (objects) type.
|
|
89
93
|
*/
|
|
90
94
|
value?: Array<any>;
|
|
95
|
+
/**
|
|
96
|
+
* Sets the modelValue of the MultiSelectTree. It can either be an array of the primitive (string, numbers) or of the complex (objects) type.
|
|
97
|
+
*/
|
|
98
|
+
modelValue?: Array<any>;
|
|
91
99
|
/**
|
|
92
100
|
* The hint that is displayed when the MultiSelectTree is empty.
|
|
93
101
|
*/
|
|
@@ -161,7 +169,7 @@ export interface MultiSelectTreeProps extends FormComponentProps {
|
|
|
161
169
|
filterable?: boolean;
|
|
162
170
|
/**
|
|
163
171
|
* Sets the value of filtering input.
|
|
164
|
-
* Useful for making the filtering input a
|
|
172
|
+
* Useful for making the filtering input a controlled component.
|
|
165
173
|
*/
|
|
166
174
|
filter?: string;
|
|
167
175
|
/**
|
|
@@ -202,7 +210,7 @@ export interface MultiSelectTreeProps extends FormComponentProps {
|
|
|
202
210
|
*/
|
|
203
211
|
popupSettings?: DropDownsPopupSettings;
|
|
204
212
|
/**
|
|
205
|
-
* Represents a callback function, which returns the value for submitting. The returned value will be rendered in an `option` of a hidden
|
|
213
|
+
* Represents a callback function, which returns the value for submitting. The returned value will be rendered in an `option` of a hidden `select` element.
|
|
206
214
|
*
|
|
207
215
|
* @example
|
|
208
216
|
* ```jsx-no-run
|
|
@@ -16,7 +16,9 @@ var ListFilterVue2 = {
|
|
|
16
16
|
// @ts-ignore
|
|
17
17
|
emits: {
|
|
18
18
|
keydown: null,
|
|
19
|
-
change: null
|
|
19
|
+
change: null,
|
|
20
|
+
focus: null,
|
|
21
|
+
blur: null
|
|
20
22
|
},
|
|
21
23
|
props: {
|
|
22
24
|
value: String,
|
|
@@ -69,6 +71,12 @@ var ListFilterVue2 = {
|
|
|
69
71
|
},
|
|
70
72
|
onChange: function onChange(e) {
|
|
71
73
|
this.$emit('change', e);
|
|
74
|
+
},
|
|
75
|
+
handleFocus: function handleFocus(e) {
|
|
76
|
+
this.$emit('focus', e);
|
|
77
|
+
},
|
|
78
|
+
handleBlur: function handleBlur(e) {
|
|
79
|
+
this.$emit('blur', e);
|
|
72
80
|
}
|
|
73
81
|
},
|
|
74
82
|
mounted: function mounted() {
|
|
@@ -103,9 +111,13 @@ var ListFilterVue2 = {
|
|
|
103
111
|
onInput: this.onChange,
|
|
104
112
|
on: this.v3 ? undefined : {
|
|
105
113
|
"input": this.onChange,
|
|
106
|
-
"keydown": this.onKeyDown
|
|
114
|
+
"keydown": this.onKeyDown,
|
|
115
|
+
"focusin": this.handleFocus,
|
|
116
|
+
"focusout": this.handleBlur
|
|
107
117
|
},
|
|
108
|
-
onKeydown: this.onKeyDown
|
|
118
|
+
onKeydown: this.onKeyDown,
|
|
119
|
+
onFocusin: this.handleFocus,
|
|
120
|
+
onFocusout: this.handleBlur
|
|
109
121
|
})])]);
|
|
110
122
|
}
|
|
111
123
|
};
|
|
@@ -5,7 +5,7 @@ export var packageMetadata = {
|
|
|
5
5
|
name: '@progress/kendo-vue-dropdowns',
|
|
6
6
|
productName: 'Kendo UI for Vue',
|
|
7
7
|
productCodes: ['KENDOUIVUE', 'KENDOUICOMPLETE'],
|
|
8
|
-
publishDate:
|
|
8
|
+
publishDate: 1682342566,
|
|
9
9
|
version: '',
|
|
10
10
|
licensingDocsUrl: 'https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning'
|
|
11
11
|
};
|
|
@@ -269,10 +269,12 @@ var ComboBoxVue2 = {
|
|
|
269
269
|
this.base.scrollToVirtualItem(virtual, selectedItemIndex);
|
|
270
270
|
this.prevCurrentOpened = true;
|
|
271
271
|
} else if (opening && !virtual) {
|
|
272
|
-
this.base.scrollToItem(selectedItemIndex);
|
|
272
|
+
this.base.scrollToItem(selectedItem ? selectedItemIndex : this.getFocusedIndex());
|
|
273
273
|
this.prevCurrentOpened = true;
|
|
274
274
|
} else if (opened && prevOpened && selectedItem && selectedItemChanged) {
|
|
275
275
|
this.base.scrollToItem(selectedItemIndex);
|
|
276
|
+
} else if (opened && !selectedItem) {
|
|
277
|
+
this.base.scrollToItem(this.getFocusedIndex());
|
|
276
278
|
}
|
|
277
279
|
}
|
|
278
280
|
if (opening && this.input) {
|
|
@@ -135,7 +135,7 @@ export interface DropDownTreeProps extends FormComponentProps {
|
|
|
135
135
|
filterable?: boolean;
|
|
136
136
|
/**
|
|
137
137
|
* Sets the value of filtering input.
|
|
138
|
-
* Useful for making the filtering input a
|
|
138
|
+
* Useful for making the filtering input a controlled component.
|
|
139
139
|
*/
|
|
140
140
|
filter?: string;
|
|
141
141
|
/**
|
|
@@ -172,7 +172,7 @@ export interface DropDownTreeProps extends FormComponentProps {
|
|
|
172
172
|
*/
|
|
173
173
|
popupSettings?: DropDownsPopupSettings;
|
|
174
174
|
/**
|
|
175
|
-
* Represents a callback function, which returns the value for submitting. The returned value will be rendered in an `option` of a hidden
|
|
175
|
+
* Represents a callback function, which returns the value for submitting. The returned value will be rendered in an `option` of a hidden `select`.
|
|
176
176
|
*
|
|
177
177
|
* @example
|
|
178
178
|
* ```jsx-no-run
|
|
@@ -36,6 +36,7 @@ import { FloatingLabel } from '@progress/kendo-vue-labels';
|
|
|
36
36
|
import { TagList } from '../MultiSelect/TagList.js';
|
|
37
37
|
import { ClearButton } from '../common/ClearButton.js';
|
|
38
38
|
import { ListFilter } from '../common/ListFilter.js';
|
|
39
|
+
import { getMultiSelectTreeValue } from './utils.js';
|
|
39
40
|
var VALIDATION_MESSAGE = 'Please select a value from the list!';
|
|
40
41
|
var sizeMap = kendoThemeMaps.sizeMap,
|
|
41
42
|
roundedMap = kendoThemeMaps.roundedMap;
|
|
@@ -59,6 +60,9 @@ var getValidity = function getValidity(parameters, hasValue) {
|
|
|
59
60
|
*/
|
|
60
61
|
var MultiSelectTreeVue2 = {
|
|
61
62
|
name: 'KendoMultiSelectTree',
|
|
63
|
+
model: {
|
|
64
|
+
event: 'changemodel'
|
|
65
|
+
},
|
|
62
66
|
// @ts-ignore
|
|
63
67
|
emits: {
|
|
64
68
|
open: null,
|
|
@@ -67,7 +71,9 @@ var MultiSelectTreeVue2 = {
|
|
|
67
71
|
blur: null,
|
|
68
72
|
change: null,
|
|
69
73
|
filterChange: null,
|
|
70
|
-
expandChange: null
|
|
74
|
+
expandChange: null,
|
|
75
|
+
'changemodel': null,
|
|
76
|
+
'update:modelValue': null
|
|
71
77
|
},
|
|
72
78
|
props: {
|
|
73
79
|
opened: {
|
|
@@ -85,6 +91,7 @@ var MultiSelectTreeVue2 = {
|
|
|
85
91
|
}
|
|
86
92
|
},
|
|
87
93
|
value: Array,
|
|
94
|
+
modelValue: Array,
|
|
88
95
|
valueMap: Function,
|
|
89
96
|
placeholder: String,
|
|
90
97
|
dataItemKey: {
|
|
@@ -117,7 +124,7 @@ var MultiSelectTreeVue2 = {
|
|
|
117
124
|
},
|
|
118
125
|
valid: {
|
|
119
126
|
type: Boolean,
|
|
120
|
-
default:
|
|
127
|
+
default: undefined
|
|
121
128
|
},
|
|
122
129
|
required: Boolean,
|
|
123
130
|
name: String,
|
|
@@ -189,7 +196,7 @@ var MultiSelectTreeVue2 = {
|
|
|
189
196
|
return this.opened !== undefined ? this.opened : this.openState;
|
|
190
197
|
},
|
|
191
198
|
computedValue: function computedValue() {
|
|
192
|
-
return this.value !== undefined ? this.value : this.currentValue;
|
|
199
|
+
return this.value !== undefined ? this.value : this.$props.modelValue !== undefined ? this.$props.modelValue : this.currentValue;
|
|
193
200
|
},
|
|
194
201
|
hasValue: function hasValue() {
|
|
195
202
|
return !!this.computedValue.length;
|
|
@@ -314,13 +321,13 @@ var MultiSelectTreeVue2 = {
|
|
|
314
321
|
on: this.v3 ? undefined : {
|
|
315
322
|
"keydown": this.onWrapperKeyDown,
|
|
316
323
|
"mousedown": this.onWrapperMouseDown,
|
|
317
|
-
"
|
|
318
|
-
"
|
|
324
|
+
"focusin": this.onFocus,
|
|
325
|
+
"focusout": this.onBlur,
|
|
319
326
|
"click": this.onWrapperClick
|
|
320
327
|
},
|
|
321
328
|
onMousedown: this.onWrapperMouseDown,
|
|
322
|
-
|
|
323
|
-
|
|
329
|
+
onFocusin: this.onFocus,
|
|
330
|
+
onFocusout: this.onBlur,
|
|
324
331
|
role: "combobox",
|
|
325
332
|
"aria-haspopup": "true",
|
|
326
333
|
"aria-expanded": this.isOpen,
|
|
@@ -345,7 +352,9 @@ var MultiSelectTreeVue2 = {
|
|
|
345
352
|
focused: this.focusedTagState ? this.tagsToRenderRef.find(function (t) {
|
|
346
353
|
return matchTags(t, _this.focusedTagState, dataItemKey);
|
|
347
354
|
}) : undefined,
|
|
348
|
-
|
|
355
|
+
tagsRounded: rounded,
|
|
356
|
+
size: size,
|
|
357
|
+
fillMode: fillMode
|
|
349
358
|
},
|
|
350
359
|
onTagdelete: this.onTagDelete,
|
|
351
360
|
on: this.v3 ? undefined : {
|
|
@@ -356,8 +365,10 @@ var MultiSelectTreeVue2 = {
|
|
|
356
365
|
focused: this.focusedTagState ? this.tagsToRenderRef.find(function (t) {
|
|
357
366
|
return matchTags(t, _this.focusedTagState, dataItemKey);
|
|
358
367
|
}) : undefined,
|
|
359
|
-
|
|
360
|
-
|
|
368
|
+
tagsRounded: rounded,
|
|
369
|
+
size: size,
|
|
370
|
+
fillMode: fillMode
|
|
371
|
+
}) : !this.hasValue && h("span", {
|
|
361
372
|
"class": "k-input-inner",
|
|
362
373
|
role: 'combobox',
|
|
363
374
|
attrs: this.v3 ? undefined : {
|
|
@@ -373,7 +384,7 @@ var MultiSelectTreeVue2 = {
|
|
|
373
384
|
"aria-label": this.$props.ariaLabelledBy
|
|
374
385
|
}, [h("span", {
|
|
375
386
|
"class": "k-input-value-text"
|
|
376
|
-
}, [
|
|
387
|
+
}, [placeholder])])]), this.$props.loading && h(Icon, {
|
|
377
388
|
"class": "k-input-loading-icon",
|
|
378
389
|
name: "loading",
|
|
379
390
|
attrs: this.v3 ? undefined : {
|
|
@@ -390,11 +401,13 @@ var MultiSelectTreeVue2 = {
|
|
|
390
401
|
name: name,
|
|
391
402
|
tabIndex: -1,
|
|
392
403
|
"aria-hidden": true,
|
|
404
|
+
required: required,
|
|
393
405
|
title: label
|
|
394
406
|
},
|
|
395
407
|
ref: setRef(this, 'select'),
|
|
396
408
|
tabIndex: -1,
|
|
397
409
|
"aria-hidden": true,
|
|
410
|
+
required: required,
|
|
398
411
|
title: label,
|
|
399
412
|
style: {
|
|
400
413
|
opacity: 0,
|
|
@@ -453,12 +466,16 @@ var MultiSelectTreeVue2 = {
|
|
|
453
466
|
onChange: _this2.onFilterChange,
|
|
454
467
|
on: _this2.v3 ? undefined : {
|
|
455
468
|
"change": _this2.onFilterChange,
|
|
456
|
-
"keydown": _this2.onInputKeyDown
|
|
469
|
+
"keydown": _this2.onInputKeyDown,
|
|
470
|
+
"focus": _this2.onFocus,
|
|
471
|
+
"blur": _this2.onBlur
|
|
457
472
|
},
|
|
458
473
|
onKeydown: _this2.onInputKeyDown,
|
|
459
474
|
size: size,
|
|
460
475
|
rounded: rounded,
|
|
461
|
-
fillMode: fillMode
|
|
476
|
+
fillMode: fillMode,
|
|
477
|
+
onFocus: _this2.onFocus,
|
|
478
|
+
onBlur: _this2.onBlur
|
|
462
479
|
}), header && h("div", {
|
|
463
480
|
"class": "k-list-header"
|
|
464
481
|
}, [header]), dataItems.length > 0 ?
|
|
@@ -493,11 +510,13 @@ var MultiSelectTreeVue2 = {
|
|
|
493
510
|
"itemclick": _this2.onChange,
|
|
494
511
|
"checkchange": _this2.onChange,
|
|
495
512
|
"expandchange": _this2.onExpand,
|
|
513
|
+
"focus": _this2.onFocus,
|
|
496
514
|
"blur": _this2.onBlur,
|
|
497
515
|
"keydown": _this2.onWrapperKeyDown
|
|
498
516
|
},
|
|
499
517
|
onCheckchange: _this2.onChange,
|
|
500
518
|
onExpandchange: _this2.onExpand,
|
|
519
|
+
onFocus: _this2.onFocus,
|
|
501
520
|
onBlur: _this2.onBlur,
|
|
502
521
|
onKeydown: _this2.onWrapperKeyDown,
|
|
503
522
|
checkboxes: true,
|
|
@@ -518,12 +537,16 @@ var MultiSelectTreeVue2 = {
|
|
|
518
537
|
onChange: _this2.onFilterChange,
|
|
519
538
|
on: _this2.v3 ? undefined : {
|
|
520
539
|
"change": _this2.onFilterChange,
|
|
521
|
-
"keydown": _this2.onInputKeyDown
|
|
540
|
+
"keydown": _this2.onInputKeyDown,
|
|
541
|
+
"focus": _this2.onFocus,
|
|
542
|
+
"blur": _this2.onBlur
|
|
522
543
|
},
|
|
523
544
|
onKeydown: _this2.onInputKeyDown,
|
|
524
545
|
size: size,
|
|
525
546
|
rounded: rounded,
|
|
526
|
-
fillMode: fillMode
|
|
547
|
+
fillMode: fillMode,
|
|
548
|
+
onFocus: _this2.onFocus,
|
|
549
|
+
onBlur: _this2.onBlur
|
|
527
550
|
}), header && h("div", {
|
|
528
551
|
"class": "k-list-header"
|
|
529
552
|
}, [header]), dataItems.length > 0 ? h(TreeView, {
|
|
@@ -556,11 +579,13 @@ var MultiSelectTreeVue2 = {
|
|
|
556
579
|
"itemclick": _this2.onChange,
|
|
557
580
|
"checkchange": _this2.onChange,
|
|
558
581
|
"expandchange": _this2.onExpand,
|
|
582
|
+
"focus": _this2.onFocus,
|
|
559
583
|
"blur": _this2.onBlur,
|
|
560
584
|
"keydown": _this2.onWrapperKeyDown
|
|
561
585
|
},
|
|
562
586
|
onCheckchange: _this2.onChange,
|
|
563
587
|
onExpandchange: _this2.onExpand,
|
|
588
|
+
onFocus: _this2.onFocus,
|
|
564
589
|
onBlur: _this2.onBlur,
|
|
565
590
|
onKeydown: _this2.onWrapperKeyDown,
|
|
566
591
|
checkboxes: true,
|
|
@@ -617,11 +642,26 @@ var MultiSelectTreeVue2 = {
|
|
|
617
642
|
this.selectRef.setCustomValidity(validity.valid ? '' : this.validationMessage === undefined ? VALIDATION_MESSAGE : this.validationMessage);
|
|
618
643
|
}
|
|
619
644
|
},
|
|
620
|
-
changeValue: function changeValue(event,
|
|
645
|
+
changeValue: function changeValue(event, items, operation) {
|
|
646
|
+
var fields = {
|
|
647
|
+
dataItemKey: this.dataItemKey,
|
|
648
|
+
checkField: this.checkField,
|
|
649
|
+
checkIndeterminateField: this.checkIndeterminateField,
|
|
650
|
+
expandField: this.expandField,
|
|
651
|
+
subItemsField: this.subItemsField
|
|
652
|
+
};
|
|
653
|
+
var value = getMultiSelectTreeValue(this.dataItems, __assign(__assign({}, fields), {
|
|
654
|
+
items: items,
|
|
655
|
+
operation: operation,
|
|
656
|
+
value: this.value
|
|
657
|
+
}));
|
|
621
658
|
var changeEvent = __assign({
|
|
622
|
-
items:
|
|
623
|
-
operation: operation
|
|
659
|
+
items: items,
|
|
660
|
+
operation: operation,
|
|
661
|
+
value: value
|
|
624
662
|
}, event);
|
|
663
|
+
this.$emit('changemodel', value);
|
|
664
|
+
this.$emit('update:modelValue', value);
|
|
625
665
|
this.$emit('change', changeEvent);
|
|
626
666
|
},
|
|
627
667
|
onChange: function onChange(e) {
|
|
@@ -701,6 +741,7 @@ var MultiSelectTreeVue2 = {
|
|
|
701
741
|
},
|
|
702
742
|
onBlur: function onBlur(event) {
|
|
703
743
|
if (this.focusedState && !this.skipFocusRef) {
|
|
744
|
+
this.focusedTagState = undefined;
|
|
704
745
|
this.focusedState = false;
|
|
705
746
|
var ev = {
|
|
706
747
|
event: event,
|
|
@@ -744,7 +785,7 @@ var MultiSelectTreeVue2 = {
|
|
|
744
785
|
event: event,
|
|
745
786
|
target: this
|
|
746
787
|
};
|
|
747
|
-
if (this.value && this.value.length > 0 && (keyCode === Keys.left || keyCode === Keys.right || keyCode === Keys.home || keyCode === Keys.end || keyCode === Keys.delete)) {
|
|
788
|
+
if (this.value && this.value.length > 0 && (keyCode === Keys.left || keyCode === Keys.right || keyCode === Keys.home || keyCode === Keys.end || keyCode === Keys.delete || keyCode === Keys.backspace)) {
|
|
748
789
|
var tagsToRender = this.tagsToRenderRef;
|
|
749
790
|
var focusedIndex = this.focusedTagState ? tagsToRender.findIndex(function (t) {
|
|
750
791
|
return matchTags(t, _this.focusedTagState, _this.dataItemKey);
|
|
@@ -769,7 +810,7 @@ var MultiSelectTreeVue2 = {
|
|
|
769
810
|
newFocusedTag = tagsToRender[0];
|
|
770
811
|
} else if (keyCode === Keys.end) {
|
|
771
812
|
newFocusedTag = tagsToRender[tagsToRender.length - 1];
|
|
772
|
-
} else if (keyCode === Keys.delete) {
|
|
813
|
+
} else if (keyCode === Keys.delete || keyCode === Keys.backspace) {
|
|
773
814
|
if (hasFocused) {
|
|
774
815
|
this.changeValue(ev, tagsToRender[focusedIndex].data, 'delete');
|
|
775
816
|
}
|
|
@@ -781,6 +822,9 @@ var MultiSelectTreeVue2 = {
|
|
|
781
822
|
if (this.isOpen) {
|
|
782
823
|
if (keyCode === Keys.esc || altKey && keyCode === Keys.up) {
|
|
783
824
|
event.preventDefault();
|
|
825
|
+
this.switchFocus(function () {
|
|
826
|
+
_this.focusElement(_this.elementRef);
|
|
827
|
+
});
|
|
784
828
|
this.closePopup(ev);
|
|
785
829
|
} 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
830
|
if (keyCode === Keys.up) {
|
|
@@ -816,7 +860,7 @@ var MultiSelectTreeVue2 = {
|
|
|
816
860
|
}
|
|
817
861
|
event.preventDefault();
|
|
818
862
|
this.switchFocus(keyCode === Keys.up ? function () {
|
|
819
|
-
_this.focusElement(_this
|
|
863
|
+
_this.focusElement(_this.elementRef);
|
|
820
864
|
} : function () {
|
|
821
865
|
_this.focusElement(_this.treeViewRef && _this.treeViewRef.$el);
|
|
822
866
|
});
|