@progress/kendo-vue-dropdowns 3.14.2 → 3.15.0-dev.202309281301

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 (62) hide show
  1. package/dist/cdn/js/kendo-vue-dropdowns.js +1 -1
  2. package/dist/es/ComboBox/ComboBox.js +244 -42
  3. package/dist/es/ComboBox/ComboBoxProps.d.ts +8 -0
  4. package/dist/es/DropDownList/DropDownList.d.ts +3 -0
  5. package/dist/es/DropDownList/DropDownList.js +197 -43
  6. package/dist/es/DropDownList/DropDownListProps.d.ts +8 -0
  7. package/dist/es/DropDownTree/DropDownTree.js +257 -105
  8. package/dist/es/DropDownTree/DropDownTreeProps.d.ts +8 -0
  9. package/dist/es/MultiSelect/MultiSelect.js +340 -65
  10. package/dist/es/MultiSelect/MultiSelectProps.d.ts +8 -0
  11. package/dist/es/MultiSelectTree/MultiSelectTree.js +345 -127
  12. package/dist/es/MultiSelectTree/MultiSelectTreeProps.d.ts +8 -0
  13. package/dist/es/common/DropDownBase.d.ts +7 -0
  14. package/dist/es/common/DropDownBase.js +13 -1
  15. package/dist/es/common/ListFilter.d.ts +1 -0
  16. package/dist/es/common/ListFilter.js +31 -25
  17. package/dist/es/common/constants.d.ts +4 -0
  18. package/dist/es/common/constants.js +4 -0
  19. package/dist/es/messages/main.d.ts +10 -0
  20. package/dist/es/messages/main.js +10 -0
  21. package/dist/es/package-metadata.js +1 -1
  22. package/dist/esm/ComboBox/ComboBox.js +244 -42
  23. package/dist/esm/ComboBox/ComboBoxProps.d.ts +8 -0
  24. package/dist/esm/DropDownList/DropDownList.d.ts +3 -0
  25. package/dist/esm/DropDownList/DropDownList.js +197 -43
  26. package/dist/esm/DropDownList/DropDownListProps.d.ts +8 -0
  27. package/dist/esm/DropDownTree/DropDownTree.js +257 -105
  28. package/dist/esm/DropDownTree/DropDownTreeProps.d.ts +8 -0
  29. package/dist/esm/MultiSelect/MultiSelect.js +340 -65
  30. package/dist/esm/MultiSelect/MultiSelectProps.d.ts +8 -0
  31. package/dist/esm/MultiSelectTree/MultiSelectTree.js +345 -127
  32. package/dist/esm/MultiSelectTree/MultiSelectTreeProps.d.ts +8 -0
  33. package/dist/esm/common/DropDownBase.d.ts +7 -0
  34. package/dist/esm/common/DropDownBase.js +13 -1
  35. package/dist/esm/common/ListFilter.d.ts +1 -0
  36. package/dist/esm/common/ListFilter.js +31 -25
  37. package/dist/esm/common/constants.d.ts +4 -0
  38. package/dist/esm/common/constants.js +4 -0
  39. package/dist/esm/messages/main.d.ts +10 -0
  40. package/dist/esm/messages/main.js +10 -0
  41. package/dist/esm/package-metadata.js +1 -1
  42. package/dist/npm/ComboBox/ComboBox.js +242 -40
  43. package/dist/npm/ComboBox/ComboBoxProps.d.ts +8 -0
  44. package/dist/npm/DropDownList/DropDownList.d.ts +3 -0
  45. package/dist/npm/DropDownList/DropDownList.js +195 -41
  46. package/dist/npm/DropDownList/DropDownListProps.d.ts +8 -0
  47. package/dist/npm/DropDownTree/DropDownTree.js +254 -102
  48. package/dist/npm/DropDownTree/DropDownTreeProps.d.ts +8 -0
  49. package/dist/npm/MultiSelect/MultiSelect.js +338 -63
  50. package/dist/npm/MultiSelect/MultiSelectProps.d.ts +8 -0
  51. package/dist/npm/MultiSelectTree/MultiSelectTree.js +343 -125
  52. package/dist/npm/MultiSelectTree/MultiSelectTreeProps.d.ts +8 -0
  53. package/dist/npm/common/DropDownBase.d.ts +7 -0
  54. package/dist/npm/common/DropDownBase.js +12 -0
  55. package/dist/npm/common/ListFilter.d.ts +1 -0
  56. package/dist/npm/common/ListFilter.js +31 -25
  57. package/dist/npm/common/constants.d.ts +4 -0
  58. package/dist/npm/common/constants.js +10 -0
  59. package/dist/npm/messages/main.d.ts +10 -0
  60. package/dist/npm/messages/main.js +11 -1
  61. package/dist/npm/package-metadata.js +1 -1
  62. package/package.json +12 -9
@@ -279,4 +279,12 @@ export interface MultiSelectProps extends FormComponentProps {
279
279
  * Fires when a MultiSelect sticky group header item is about to be rendered. Used to override the default appearance of the sticky group header of the component.
280
280
  */
281
281
  groupStickyHeaderItemRender?: any;
282
+ /**
283
+ * Provides different rendering of the popup element based on the screen dimensions.
284
+ */
285
+ adaptive?: boolean;
286
+ /**
287
+ * Specifies the text that is rendered as title in the adaptive popup.
288
+ */
289
+ adaptiveTitle?: string;
282
290
  }
@@ -24,19 +24,24 @@ import * as Vue from 'vue';
24
24
  var allVue = Vue;
25
25
  var gh = allVue.h;
26
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';
27
+ import { classNames, noop, getTabIndex, Keys, guid, kendoThemeMaps, Icon, getRef, setRef, validatePackage, templateRendering, getListeners, getTemplate, canUseDOM } from '@progress/kendo-vue-common';
28
28
  import { Popup } from '@progress/kendo-vue-popup';
29
29
  import { provideLocalizationService } from '@progress/kendo-vue-intl';
30
30
  import { TreeView } from '@progress/kendo-vue-treeview';
31
31
  import { packageMetadata } from './../package-metadata.js';
32
32
  import { getItemValue, areSame, matchTags } from '../common/utils.js';
33
33
  import { ListNoData } from './../DropDownTree/ListNoData.js';
34
- import { messages, nodata } from './../messages/main.js';
34
+ import { messages, nodata, adaptiveModeFooterApply, adaptiveModeFooterCancel } from './../messages/main.js';
35
35
  import { FloatingLabel } from '@progress/kendo-vue-labels';
36
+ import { Button as KButton } from '@progress/kendo-vue-buttons';
36
37
  import { TagList } from '../MultiSelect/TagList.js';
37
38
  import { ClearButton } from '../common/ClearButton.js';
38
39
  import { ListFilter } from '../common/ListFilter.js';
39
40
  import { getMultiSelectTreeValue } from './utils.js';
41
+ import { MOBILE_SMALL_DEVICE, MOBILE_MEDIUM_DEVICE } from '../common/constants.js';
42
+ import { ActionSheet } from '@progress/kendo-vue-layout';
43
+ import { xIcon } from '@progress/kendo-svg-icons';
44
+ import DropDownBase from '../common/DropDownBase.js';
40
45
  var VALIDATION_MESSAGE = 'Please select a value from the list!';
41
46
  var sizeMap = kendoThemeMaps.sizeMap,
42
47
  roundedMap = kendoThemeMaps.roundedMap;
@@ -169,7 +174,15 @@ var MultiSelectTreeVue2 = {
169
174
  tag: [String, Function, Object],
170
175
  header: [String, Function, Object],
171
176
  footer: [String, Function, Object],
172
- listNoData: [String, Function, Object]
177
+ listNoData: [String, Function, Object],
178
+ adaptive: {
179
+ type: Boolean,
180
+ default: undefined
181
+ },
182
+ adaptiveTitle: {
183
+ type: String,
184
+ default: undefined
185
+ }
173
186
  },
174
187
  inject: {
175
188
  kendoLocalizationService: {
@@ -177,7 +190,9 @@ var MultiSelectTreeVue2 = {
177
190
  }
178
191
  },
179
192
  created: function created() {
193
+ this.observer = null;
180
194
  validatePackage(packageMetadata);
195
+ this.base = new DropDownBase(this);
181
196
  this.componentGuid = guid();
182
197
  this.anchor = guid();
183
198
  },
@@ -188,10 +203,31 @@ var MultiSelectTreeVue2 = {
188
203
  focusedState: false,
189
204
  filterState: '',
190
205
  currentValue: [],
191
- popupWidth: '200px'
206
+ popupWidth: '200px',
207
+ windowWidth: 0,
208
+ initialAdaptiveRenderingValues: undefined
192
209
  };
193
210
  },
194
211
  computed: {
212
+ animationStyles: {
213
+ get: function get() {
214
+ return this.windowWidth <= MOBILE_SMALL_DEVICE ? {
215
+ top: 0,
216
+ width: '100%',
217
+ height: '100%'
218
+ } : undefined;
219
+ }
220
+ },
221
+ classNameAdaptive: {
222
+ get: function get() {
223
+ return this.windowWidth <= MOBILE_SMALL_DEVICE ? 'k-adaptive-actionsheet k-actionsheet-fullscreen' : 'k-adaptive-actionsheet k-actionsheet-bottom';
224
+ }
225
+ },
226
+ adaptiveState: {
227
+ get: function get() {
228
+ return this.windowWidth <= MOBILE_MEDIUM_DEVICE && this.$props.adaptive;
229
+ }
230
+ },
195
231
  isOpen: function isOpen() {
196
232
  return this.opened !== undefined ? this.opened : this.openState;
197
233
  },
@@ -203,15 +239,39 @@ var MultiSelectTreeVue2 = {
203
239
  },
204
240
  tagsToRenderRef: function tagsToRenderRef() {
205
241
  var _this = this;
206
- return this.tags === undefined ? this.computedValue.map(function (item) {
207
- return {
208
- text: getItemValue(item, _this.$props.textField),
209
- data: [item]
210
- };
211
- }) : __spreadArray([], this.tags, true);
242
+ if (this.initialAdaptiveRenderingValues === undefined) {
243
+ return this.tags === undefined ? this.computedValue.map(function (item) {
244
+ return {
245
+ text: getItemValue(item, _this.$props.textField),
246
+ data: [item]
247
+ };
248
+ }) : __spreadArray([], this.tags, true);
249
+ } else {
250
+ var valuesBeforeAdaptiveRendering = this.initialAdaptiveRenderingValues;
251
+ return valuesBeforeAdaptiveRendering.length > 0 && valuesBeforeAdaptiveRendering.map(function (item) {
252
+ return {
253
+ text: getItemValue(item, _this.$props.textField),
254
+ data: [item]
255
+ };
256
+ });
257
+ }
258
+ }
259
+ },
260
+ watch: {
261
+ // This watch gets the state of the data when the adaptive mode is activated
262
+ isOpen: function isOpen(newValue) {
263
+ if (newValue && this.value) {
264
+ this.initialAdaptiveRenderingValues = __spreadArray([], this.value, true);
265
+ } else {
266
+ this.initialAdaptiveRenderingValues = undefined;
267
+ }
212
268
  }
213
269
  },
214
270
  mounted: function mounted() {
271
+ this.observer = canUseDOM && new ResizeObserver(this.calculateMedia);
272
+ if ((document === null || document === void 0 ? void 0 : document.body) && this.observer) {
273
+ this.observer.observe(document.body);
274
+ }
215
275
  this.elementRef = getRef(this, 'kendoAnchor', this.anchor);
216
276
  this.inputRef = getRef(this, 'input');
217
277
  this.selectRef = getRef(this, 'select');
@@ -220,6 +280,11 @@ var MultiSelectTreeVue2 = {
220
280
  this.popupRef = getRef(this, 'popup');
221
281
  this.calculatePopupWidth();
222
282
  },
283
+ destroyed: !!isV3 ? undefined : function () {
284
+ if (this.observer) {
285
+ this.observer.disconnect();
286
+ }
287
+ },
223
288
  updated: function updated() {
224
289
  this.inputRef = getRef(this, 'input');
225
290
  this.treeViewRef = getRef(this, 'treeView');
@@ -238,7 +303,6 @@ var MultiSelectTreeVue2 = {
238
303
  },
239
304
  // @ts-ignore
240
305
  render: function render(createElement) {
241
- var _this2 = this;
242
306
  var _a, _b;
243
307
  var _this = this;
244
308
  var h = gh || createElement;
@@ -259,7 +323,8 @@ var MultiSelectTreeVue2 = {
259
323
  valid = _c.valid,
260
324
  value = _c.value,
261
325
  required = _c.required,
262
- validityStyles = _c.validityStyles;
326
+ validityStyles = _c.validityStyles,
327
+ adaptiveTitle = _c.adaptiveTitle;
263
328
  var tabIndex = getTabIndex(this.$props.tabIndex, disabled);
264
329
  var localization = provideLocalizationService(this);
265
330
  var validity = getValidity({
@@ -268,6 +333,7 @@ var MultiSelectTreeVue2 = {
268
333
  required: required
269
334
  }, this.hasValue);
270
335
  var dir = this.$props.dir; // useRtl(elementRef,this.$props.dir);
336
+ var renderAdaptive = this.adaptiveState;
271
337
  var itemTemplate = templateRendering.call(this, this.item, getListeners.call(this));
272
338
  var tagTemplate = templateRendering.call(this, this.tag, getListeners.call(this));
273
339
  var headerTemplate = templateRendering.call(this, this.$props.header, getListeners.call(this));
@@ -296,7 +362,193 @@ var MultiSelectTreeVue2 = {
296
362
  size = _e.size,
297
363
  rounded = _e.rounded,
298
364
  fillMode = _e.fillMode;
299
- var multiselecttree = h("span", {
365
+ var adaptiveActionSheetHeaderTemplateDef = function adaptiveActionSheetHeaderTemplateDef() {
366
+ return [h("div", {
367
+ "class": "k-actionsheet-titlebar-group k-hbox"
368
+ }, [h("div", {
369
+ "class": "k-actionsheet-title"
370
+ }, [h("div", {
371
+ "class": "k-text-center"
372
+ }, [adaptiveTitle]), h("div", {
373
+ "class": "k-actionsheet-subtitle k-text-center"
374
+ }, [placeholder])]), h("div", {
375
+ "class": "k-actionsheet-actions"
376
+ }, [h(KButton, {
377
+ tabindex: 5,
378
+ attrs: this.v3 ? undefined : {
379
+ tabindex: 5,
380
+ "aria-label": "Cancel",
381
+ "aria-disabled": "false",
382
+ type: "button",
383
+ fillMode: "flat",
384
+ icon: "x",
385
+ svgIcon: xIcon
386
+ },
387
+ "aria-label": "Cancel",
388
+ "aria-disabled": "false",
389
+ type: "button",
390
+ fillMode: "flat",
391
+ onClick: _this.onCancel,
392
+ on: this.v3 ? undefined : {
393
+ "click": _this.onCancel
394
+ },
395
+ icon: "x",
396
+ svgIcon: xIcon
397
+ })])]), h("div", {
398
+ "class": "k-actionsheet-titlebar-group k-actionsheet-filter"
399
+ }, [_this.$props.filterable &&
400
+ // @ts-ignore
401
+ h(ListFilter, {
402
+ value: _this.$props.filter === undefined ? _this.filterState : _this.$props.filter,
403
+ attrs: this.v3 ? undefined : {
404
+ value: _this.$props.filter === undefined ? _this.filterState : _this.$props.filter,
405
+ size: size,
406
+ rounded: rounded,
407
+ fillMode: fillMode
408
+ },
409
+ ref: setRef(_this, 'input'),
410
+ onChange: _this.onFilterChange,
411
+ on: this.v3 ? undefined : {
412
+ "change": _this.onFilterChange,
413
+ "keydown": _this.onInputKeyDown,
414
+ "focus": _this.onFocus,
415
+ "blur": _this.onBlur
416
+ },
417
+ onKeydown: _this.onInputKeyDown,
418
+ size: size,
419
+ rounded: rounded,
420
+ fillMode: fillMode,
421
+ onFocus: _this.onFocus,
422
+ onBlur: _this.onBlur
423
+ })])];
424
+ };
425
+ var adaptiveActionSheetHeaderTemplate = templateRendering.call(this, adaptiveActionSheetHeaderTemplateDef, getListeners.call(this));
426
+ var adaptiveActionSheetFooterTemplateDef = function adaptiveActionSheetFooterTemplateDef() {
427
+ var cancelText = localization.toLanguageString(adaptiveModeFooterCancel, messages[adaptiveModeFooterCancel]);
428
+ var applyText = localization.toLanguageString(adaptiveModeFooterApply, messages[adaptiveModeFooterApply]);
429
+ return [h(KButton, {
430
+ size: "large",
431
+ attrs: this.v3 ? undefined : {
432
+ size: "large",
433
+ "aria-label": cancelText,
434
+ "aria-disabled": "false",
435
+ type: "button"
436
+ },
437
+ "aria-label": cancelText,
438
+ "aria-disabled": "false",
439
+ type: "button",
440
+ onClick: _this.onCancel,
441
+ on: this.v3 ? undefined : {
442
+ "click": _this.onCancel
443
+ }
444
+ }, [cancelText]), h(KButton, {
445
+ themeColor: "primary",
446
+ attrs: this.v3 ? undefined : {
447
+ themeColor: "primary",
448
+ size: "large",
449
+ "aria-label": applyText,
450
+ "aria-disabled": "false",
451
+ type: "button"
452
+ },
453
+ size: "large",
454
+ "aria-label": applyText,
455
+ "aria-disabled": "false",
456
+ type: "button",
457
+ onClick: _this.closePopup,
458
+ on: this.v3 ? undefined : {
459
+ "click": _this.closePopup
460
+ }
461
+ }, [applyText])];
462
+ };
463
+ var adaptiveActionSheetFooterTemplate = templateRendering.call(this, adaptiveActionSheetFooterTemplateDef, getListeners.call(this));
464
+ var adaptiveActionSheetContentTemplateDef = function adaptiveActionSheetContentTemplateDef() {
465
+ var headerToRender = _this.base.getTemplateDef.call(_this, header, h);
466
+ var footerToRender = _this.base.getTemplateDef.call(_this, footer, h);
467
+ return [headerToRender && h("div", {
468
+ "class": "k-list-header"
469
+ }, [headerToRender]), dataItems.length > 0 ?
470
+ // @ts-ignore
471
+ h(TreeView, {
472
+ ref: setRef(_this, 'treeView'),
473
+ tabIndex: tabIndex,
474
+ attrs: this.v3 ? undefined : {
475
+ tabIndex: tabIndex,
476
+ dataItems: dataItems,
477
+ focusIdField: dataItemKey,
478
+ textField: _this.$props.textField,
479
+ checkField: checkField,
480
+ checkIndeterminateField: checkIndeterminateField,
481
+ expandField: _this.$props.expandField,
482
+ childrenField: subItemsField,
483
+ expandIcons: true,
484
+ checkboxes: true,
485
+ size: 'large',
486
+ item: itemTemplate
487
+ },
488
+ dataItems: dataItems,
489
+ focusIdField: dataItemKey,
490
+ textField: _this.$props.textField,
491
+ checkField: checkField,
492
+ checkIndeterminateField: checkIndeterminateField,
493
+ expandField: _this.$props.expandField,
494
+ childrenField: subItemsField,
495
+ expandIcons: true,
496
+ onItemclick: _this.onChange,
497
+ on: this.v3 ? undefined : {
498
+ "itemclick": _this.onChange,
499
+ "checkchange": _this.onChange,
500
+ "expandchange": _this.onExpand,
501
+ "focus": _this.onFocus,
502
+ "blur": _this.onBlur,
503
+ "keydown": _this.onWrapperKeyDown
504
+ },
505
+ onCheckchange: _this.onChange,
506
+ onExpandchange: _this.onExpand,
507
+ onFocus: _this.onFocus,
508
+ onBlur: _this.onBlur,
509
+ onKeydown: _this.onWrapperKeyDown,
510
+ checkboxes: true,
511
+ size: 'large',
512
+ item: itemTemplate
513
+ }) : noDataTemplate, footerToRender && h("div", {
514
+ className: "k-list-footer",
515
+ attrs: this.v3 ? undefined : {
516
+ className: "k-list-footer"
517
+ }
518
+ }, [footerToRender])];
519
+ };
520
+ var adaptiveActionSheetContentTemplate = templateRendering.call(this, adaptiveActionSheetContentTemplateDef, getListeners.call(this));
521
+ var renderAdaptiveListContainer = function renderAdaptiveListContainer() {
522
+ return h(ActionSheet, {
523
+ expand: this.isOpen,
524
+ attrs: this.v3 ? undefined : {
525
+ expand: this.isOpen,
526
+ animation: true,
527
+ animationStyles: this.animationStyles,
528
+ className: this.classNameAdaptive,
529
+ footerClassName: 'k-actions k-actions-stretched',
530
+ contentClassName: '!k-overflow-hidden',
531
+ header: adaptiveActionSheetHeaderTemplate,
532
+ content: adaptiveActionSheetContentTemplate,
533
+ footer: adaptiveActionSheetFooterTemplate,
534
+ navigatableElements: ['input.k-input-inner', '.k-actionsheet-actions > button']
535
+ },
536
+ animation: true,
537
+ animationStyles: this.animationStyles,
538
+ className: this.classNameAdaptive,
539
+ footerClassName: 'k-actions k-actions-stretched',
540
+ contentClassName: '!k-overflow-hidden',
541
+ header: adaptiveActionSheetHeaderTemplate,
542
+ content: adaptiveActionSheetContentTemplate,
543
+ footer: adaptiveActionSheetFooterTemplate,
544
+ onClose: this.onCancel,
545
+ on: this.v3 ? undefined : {
546
+ "close": this.onCancel
547
+ },
548
+ navigatableElements: ['input.k-input-inner', '.k-actionsheet-actions > button']
549
+ });
550
+ };
551
+ var component = h("span", {
300
552
  ref: setRef(this, 'kendoAnchor', this.anchor),
301
553
  "class": classNames('k-multiselecttree 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)),
302
554
  tabIndex: tabIndex,
@@ -368,7 +620,7 @@ var MultiSelectTreeVue2 = {
368
620
  tagsRounded: rounded,
369
621
  size: size,
370
622
  fillMode: fillMode
371
- }) : !this.hasValue && h("span", {
623
+ }) : h("span", {
372
624
  "class": "k-input-inner",
373
625
  role: 'combobox',
374
626
  attrs: this.v3 ? undefined : {
@@ -424,7 +676,7 @@ var MultiSelectTreeVue2 = {
424
676
  }
425
677
  })]),
426
678
  // @ts-ignore function children
427
- h(Popup, {
679
+ !renderAdaptive && h(Popup, {
428
680
  style: {
429
681
  width: this.popupWidth,
430
682
  direction: dir
@@ -451,115 +703,45 @@ var MultiSelectTreeVue2 = {
451
703
  onClose: this.onPopupClosed,
452
704
  appendTo: popupSettings.appendTo,
453
705
  ref: setRef(this, 'popup')
454
- }, this.v3 ? function () {
455
- return [_this2.$props.filterable &&
456
- // @ts-ignore
457
- h(ListFilter, {
458
- value: _this2.$props.filter === undefined ? _this2.filterState : _this2.$props.filter,
459
- attrs: _this2.v3 ? undefined : {
460
- value: _this2.$props.filter === undefined ? _this2.filterState : _this2.$props.filter,
461
- size: size,
462
- rounded: rounded,
463
- fillMode: fillMode
464
- },
465
- ref: setRef(_this2, 'input'),
466
- onChange: _this2.onFilterChange,
467
- on: _this2.v3 ? undefined : {
468
- "change": _this2.onFilterChange,
469
- "keydown": _this2.onInputKeyDown,
470
- "focus": _this2.onFocus,
471
- "blur": _this2.onBlur
472
- },
473
- onKeydown: _this2.onInputKeyDown,
474
- size: size,
475
- rounded: rounded,
476
- fillMode: fillMode,
477
- onFocus: _this2.onFocus,
478
- onBlur: _this2.onBlur
479
- }), header && h("div", {
480
- "class": "k-list-header"
481
- }, [header]), dataItems.length > 0 ?
482
- // @ts-ignore
483
- h(TreeView, {
484
- ref: setRef(_this2, 'treeView'),
485
- tabIndex: tabIndex,
486
- attrs: _this2.v3 ? undefined : {
487
- tabIndex: tabIndex,
488
- dataItems: dataItems,
489
- focusIdField: dataItemKey,
490
- textField: _this2.$props.textField,
491
- checkField: checkField,
492
- checkIndeterminateField: checkIndeterminateField,
493
- expandField: _this2.$props.expandField,
494
- childrenField: subItemsField,
495
- expandIcons: true,
496
- checkboxes: true,
497
- size: size,
498
- item: itemTemplate
499
- },
500
- dataItems: dataItems,
501
- focusIdField: dataItemKey,
502
- textField: _this2.$props.textField,
503
- checkField: checkField,
504
- checkIndeterminateField: checkIndeterminateField,
505
- expandField: _this2.$props.expandField,
506
- childrenField: subItemsField,
507
- expandIcons: true,
508
- onItemclick: _this2.onChange,
509
- on: _this2.v3 ? undefined : {
510
- "itemclick": _this2.onChange,
511
- "checkchange": _this2.onChange,
512
- "expandchange": _this2.onExpand,
513
- "focus": _this2.onFocus,
514
- "blur": _this2.onBlur,
515
- "keydown": _this2.onWrapperKeyDown
516
- },
517
- onCheckchange: _this2.onChange,
518
- onExpandchange: _this2.onExpand,
519
- onFocus: _this2.onFocus,
520
- onBlur: _this2.onBlur,
521
- onKeydown: _this2.onWrapperKeyDown,
522
- checkboxes: true,
523
- size: size,
524
- item: itemTemplate
525
- }) : noDataTemplate, footer && h("div", {
526
- "class": "k-list-footer"
527
- }, [footer])];
528
- } : [_this2.$props.filterable && h(ListFilter, {
529
- value: _this2.$props.filter === undefined ? _this2.filterState : _this2.$props.filter,
530
- attrs: _this2.v3 ? undefined : {
531
- value: _this2.$props.filter === undefined ? _this2.filterState : _this2.$props.filter,
706
+ }, [this.$props.filterable &&
707
+ // @ts-ignore
708
+ h(ListFilter, {
709
+ value: this.$props.filter === undefined ? this.filterState : this.$props.filter,
710
+ attrs: this.v3 ? undefined : {
711
+ value: this.$props.filter === undefined ? this.filterState : this.$props.filter,
532
712
  size: size,
533
713
  rounded: rounded,
534
714
  fillMode: fillMode
535
715
  },
536
- ref: setRef(_this2, 'input'),
537
- onChange: _this2.onFilterChange,
538
- on: _this2.v3 ? undefined : {
539
- "change": _this2.onFilterChange,
540
- "keydown": _this2.onInputKeyDown,
541
- "focus": _this2.onFocus,
542
- "blur": _this2.onBlur
716
+ ref: setRef(this, 'input'),
717
+ onChange: this.onFilterChange,
718
+ on: this.v3 ? undefined : {
719
+ "change": this.onFilterChange,
720
+ "keydown": this.onInputKeyDown,
721
+ "focus": this.onFocus,
722
+ "blur": this.onBlur
543
723
  },
544
- onKeydown: _this2.onInputKeyDown,
724
+ onKeydown: this.onInputKeyDown,
545
725
  size: size,
546
726
  rounded: rounded,
547
727
  fillMode: fillMode,
548
- onFocus: _this2.onFocus,
549
- onBlur: _this2.onBlur
728
+ onFocus: this.onFocus,
729
+ onBlur: this.onBlur
550
730
  }), header && h("div", {
551
731
  "class": "k-list-header"
552
- }, [header]), dataItems.length > 0 ? h(TreeView, {
553
- ref: setRef(_this2, 'treeView'),
732
+ }, [header]), dataItems.length > 0 ?
733
+ // @ts-ignore
734
+ h(TreeView, {
735
+ ref: setRef(this, 'treeView'),
554
736
  tabIndex: tabIndex,
555
- attrs: _this2.v3 ? undefined : {
737
+ attrs: this.v3 ? undefined : {
556
738
  tabIndex: tabIndex,
557
739
  dataItems: dataItems,
558
740
  focusIdField: dataItemKey,
559
- textField: _this2.$props.textField,
741
+ textField: this.$props.textField,
560
742
  checkField: checkField,
561
743
  checkIndeterminateField: checkIndeterminateField,
562
- expandField: _this2.$props.expandField,
744
+ expandField: this.$props.expandField,
563
745
  childrenField: subItemsField,
564
746
  expandIcons: true,
565
747
  checkboxes: true,
@@ -568,32 +750,36 @@ var MultiSelectTreeVue2 = {
568
750
  },
569
751
  dataItems: dataItems,
570
752
  focusIdField: dataItemKey,
571
- textField: _this2.$props.textField,
753
+ textField: this.$props.textField,
572
754
  checkField: checkField,
573
755
  checkIndeterminateField: checkIndeterminateField,
574
- expandField: _this2.$props.expandField,
756
+ expandField: this.$props.expandField,
575
757
  childrenField: subItemsField,
576
758
  expandIcons: true,
577
- onItemclick: _this2.onChange,
578
- on: _this2.v3 ? undefined : {
579
- "itemclick": _this2.onChange,
580
- "checkchange": _this2.onChange,
581
- "expandchange": _this2.onExpand,
582
- "focus": _this2.onFocus,
583
- "blur": _this2.onBlur,
584
- "keydown": _this2.onWrapperKeyDown
759
+ onItemclick: this.onChange,
760
+ on: this.v3 ? undefined : {
761
+ "itemclick": this.onChange,
762
+ "checkchange": this.onChange,
763
+ "expandchange": this.onExpand,
764
+ "focus": this.onFocus,
765
+ "blur": this.onBlur,
766
+ "keydown": this.onWrapperKeyDown
585
767
  },
586
- onCheckchange: _this2.onChange,
587
- onExpandchange: _this2.onExpand,
588
- onFocus: _this2.onFocus,
589
- onBlur: _this2.onBlur,
590
- onKeydown: _this2.onWrapperKeyDown,
768
+ onCheckchange: this.onChange,
769
+ onExpandchange: this.onExpand,
770
+ onFocus: this.onFocus,
771
+ onBlur: this.onBlur,
772
+ onKeydown: this.onWrapperKeyDown,
591
773
  checkboxes: true,
592
774
  size: size,
593
775
  item: itemTemplate
594
776
  }) : noDataTemplate, footer && h("div", {
595
777
  "class": "k-list-footer"
596
778
  }, [footer])])]);
779
+ // The following one combines the default rendering of the MultiSelect and the Adaptive rendering.
780
+ // This is needed because of Vue 2 specifics
781
+ var multiselecttree = [component, renderAdaptive && renderAdaptiveListContainer.call(this)];
782
+ var multiselecttreeToRender = isV3 ? multiselecttree : this.$props.adaptive ? h("span", [multiselecttree]) : component;
597
783
  return label ?
598
784
  // @ts-ignore function children
599
785
  h(FloatingLabel, {
@@ -614,10 +800,36 @@ var MultiSelectTreeVue2 = {
614
800
  editorId: id,
615
801
  dir: dir
616
802
  }, this.v3 ? function () {
617
- return [multiselecttree];
618
- } : [multiselecttree]) : multiselecttree;
803
+ return [multiselecttreeToRender];
804
+ } : [multiselecttreeToRender]) : multiselecttreeToRender;
619
805
  },
620
806
  methods: {
807
+ clearFilter: function clearFilter(event) {
808
+ this.onFilterChange(__assign(__assign({}, event), {
809
+ target: __assign(__assign({}, event.target), {
810
+ value: ''
811
+ })
812
+ }));
813
+ },
814
+ onCancel: function onCancel(event) {
815
+ var dropdownEvent = {
816
+ event: event,
817
+ target: this
818
+ };
819
+ var changeEvent = __assign({
820
+ items: [],
821
+ operation: 'toggle',
822
+ value: this.initialAdaptiveRenderingValues
823
+ }, dropdownEvent);
824
+ this.$emit('change', changeEvent);
825
+ this.closePopup(event);
826
+ },
827
+ calculateMedia: function calculateMedia(entries) {
828
+ for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
829
+ var entry = entries_1[_i];
830
+ this.windowWidth = entry.target.clientWidth;
831
+ }
832
+ },
621
833
  calculatePopupWidth: function calculatePopupWidth() {
622
834
  if (this.elementRef) {
623
835
  this.popupWidth = this.popupSettings.width !== undefined ? this.popupSettings.width : this.elementRef.offsetWidth + 'px';
@@ -686,6 +898,7 @@ var MultiSelectTreeVue2 = {
686
898
  }
687
899
  },
688
900
  closePopup: function closePopup(event) {
901
+ this.clearFilter(event);
689
902
  if (this.isOpen) {
690
903
  var closeEvent = __assign({}, event);
691
904
  this.$emit('close', closeEvent);
@@ -740,7 +953,7 @@ var MultiSelectTreeVue2 = {
740
953
  }
741
954
  },
742
955
  onBlur: function onBlur(event) {
743
- if (this.focusedState && !this.skipFocusRef) {
956
+ if (this.focusedState && !this.skipFocusRef && !this.adaptiveState) {
744
957
  this.focusedTagState = undefined;
745
958
  this.focusedState = false;
746
959
  var ev = {
@@ -860,7 +1073,11 @@ var MultiSelectTreeVue2 = {
860
1073
  this.switchFocus(function () {
861
1074
  _this.focusElement(_this.elementRef);
862
1075
  });
863
- this.closePopup(event);
1076
+ if (keyCode === Keys.esc && this.adaptiveState) {
1077
+ this.onCancel(event);
1078
+ } else {
1079
+ this.closePopup(event);
1080
+ }
864
1081
  }
865
1082
  if (altKey || keyCode !== Keys.up && keyCode !== Keys.down) {
866
1083
  return;
@@ -879,6 +1096,7 @@ var MultiSelectTreeVue2 = {
879
1096
  };
880
1097
  this.changeValue(ev, [], 'clear');
881
1098
  this.closePopup(ev);
1099
+ this.filterState = '';
882
1100
  event.preventDefault();
883
1101
  },
884
1102
  onTagDelete: function onTagDelete(itemsToRemove, event) {
@@ -311,4 +311,12 @@ export interface MultiSelectTreeProps extends FormComponentProps {
311
311
  * @default `solid`
312
312
  */
313
313
  fillMode?: null | 'solid' | 'flat' | 'outline' | string;
314
+ /**
315
+ * Provides different rendering of the popup element based on the screen dimensions.
316
+ */
317
+ adaptive?: boolean;
318
+ /**
319
+ * Specifies the text that is rendered as title in the adaptive popup.
320
+ */
321
+ adaptiveTitle?: string;
314
322
  }