@progress/kendo-vue-dropdowns 3.10.2 → 3.11.0-dev.202305230751

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