@progress/kendo-react-dropdowns 5.13.0-dev.202304200559 → 5.13.0-dev.202304201241

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 (51) hide show
  1. package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
  2. package/dist/es/AutoComplete/AutoComplete.d.ts +11 -2
  3. package/dist/es/AutoComplete/AutoComplete.js +60 -9
  4. package/dist/es/AutoComplete/AutoCompleteProps.d.ts +22 -0
  5. package/dist/es/ComboBox/ComboBox.d.ts +5 -1
  6. package/dist/es/ComboBox/ComboBox.js +22 -11
  7. package/dist/es/ComboBox/ComboBoxProps.d.ts +18 -0
  8. package/dist/es/DropDownList/DropDownList.d.ts +5 -0
  9. package/dist/es/DropDownList/DropDownList.js +54 -9
  10. package/dist/es/DropDownList/DropDownListProps.d.ts +22 -0
  11. package/dist/es/MultiColumnComboBox/MultiColumnComboBox.js +7 -5
  12. package/dist/es/MultiSelect/MultiSelect.d.ts +44 -45
  13. package/dist/es/MultiSelect/MultiSelect.js +277 -128
  14. package/dist/es/MultiSelect/MultiSelectProps.d.ts +44 -1
  15. package/dist/es/common/DropDownBase.d.ts +1 -0
  16. package/dist/es/common/DropDownBase.js +13 -0
  17. package/dist/es/common/GroupStickyHeader.d.ts +24 -0
  18. package/dist/es/common/GroupStickyHeader.js +34 -0
  19. package/dist/es/common/List.d.ts +5 -1
  20. package/dist/es/common/List.js +9 -2
  21. package/dist/es/common/ListGroupItem.d.ts +33 -0
  22. package/dist/es/common/ListGroupItem.js +33 -0
  23. package/dist/es/common/ListItem.d.ts +4 -0
  24. package/dist/es/common/ListItem.js +3 -3
  25. package/dist/es/package-metadata.js +1 -1
  26. package/dist/npm/AutoComplete/AutoComplete.d.ts +11 -2
  27. package/dist/npm/AutoComplete/AutoComplete.js +60 -9
  28. package/dist/npm/AutoComplete/AutoCompleteProps.d.ts +22 -0
  29. package/dist/npm/ComboBox/ComboBox.d.ts +5 -1
  30. package/dist/npm/ComboBox/ComboBox.js +22 -11
  31. package/dist/npm/ComboBox/ComboBoxProps.d.ts +18 -0
  32. package/dist/npm/DropDownList/DropDownList.d.ts +5 -0
  33. package/dist/npm/DropDownList/DropDownList.js +54 -9
  34. package/dist/npm/DropDownList/DropDownListProps.d.ts +22 -0
  35. package/dist/npm/MultiColumnComboBox/MultiColumnComboBox.js +7 -5
  36. package/dist/npm/MultiSelect/MultiSelect.d.ts +44 -45
  37. package/dist/npm/MultiSelect/MultiSelect.js +276 -127
  38. package/dist/npm/MultiSelect/MultiSelectProps.d.ts +44 -1
  39. package/dist/npm/common/DropDownBase.d.ts +1 -0
  40. package/dist/npm/common/DropDownBase.js +13 -0
  41. package/dist/npm/common/GroupStickyHeader.d.ts +24 -0
  42. package/dist/npm/common/GroupStickyHeader.js +36 -0
  43. package/dist/npm/common/List.d.ts +5 -1
  44. package/dist/npm/common/List.js +9 -2
  45. package/dist/npm/common/ListGroupItem.d.ts +33 -0
  46. package/dist/npm/common/ListGroupItem.js +35 -0
  47. package/dist/npm/common/ListItem.d.ts +4 -0
  48. package/dist/npm/common/ListItem.js +3 -3
  49. package/dist/npm/package-metadata.js +1 -1
  50. package/dist/systemjs/kendo-react-dropdowns.js +1 -1
  51. package/package.json +13 -13
@@ -35,11 +35,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
35
35
  };
36
36
  import * as React from 'react';
37
37
  import * as PropTypes from 'prop-types';
38
- import { classNames, Keys, guid, createPropsContext, kendoThemeMaps, withPropsContext, IconWrap } from '@progress/kendo-react-common';
38
+ import { classNames, Keys, guid, createPropsContext, kendoThemeMaps, withPropsContext, IconWrap, canUseDOM } from '@progress/kendo-react-common';
39
39
  import { plusIcon } from '@progress/kendo-svg-icons';
40
40
  import { FloatingLabel } from '@progress/kendo-react-labels';
41
41
  import ListContainer from '../common/ListContainer';
42
42
  import List from '../common/List';
43
+ import GroupStickyHeader from '../common/GroupStickyHeader';
43
44
  import TagList from './TagList';
44
45
  import SearchBar from '../common/SearchBar';
45
46
  import DropDownBase from '../common/DropDownBase';
@@ -48,6 +49,12 @@ import { itemIndexStartsWith, getItemValue, areSame, removeDataItems, isPresent,
48
49
  import { validatePackage } from '@progress/kendo-react-common';
49
50
  import { packageMetadata } from '../package-metadata';
50
51
  import ClearButton from '../common/ClearButton';
52
+ import { AdaptiveMode } from '../common/AdaptiveMode';
53
+ import { ActionSheetContent } from '@progress/kendo-react-layout';
54
+ import { MOBILE_MEDIUM_DEVISE } from '../common/constants';
55
+ import { provideLocalizationService } from '@progress/kendo-react-intl';
56
+ import { adaptiveModeFooterApply, adaptiveModeFooterCancel, messages } from '../messages';
57
+ import ListFilter from '../common/ListFilter';
51
58
  var sizeMap = kendoThemeMaps.sizeMap, roundedMap = kendoThemeMaps.roundedMap;
52
59
  var VALIDATION_MESSAGE = 'Please enter a valid value!';
53
60
  var preventDefault = function (event) { return event.preventDefault(); };
@@ -63,11 +70,10 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
63
70
  __extends(MultiSelectWithoutContext, _super);
64
71
  function MultiSelectWithoutContext(props) {
65
72
  var _this = _super.call(this, props) || this;
66
- /**
67
- * @hidden
68
- */
73
+ /** @hidden */
69
74
  _this.state = {
70
- activedescendant: ActiveDescendant.PopupList
75
+ activedescendant: ActiveDescendant.PopupList,
76
+ currentTreeValue: []
71
77
  };
72
78
  _this._element = null;
73
79
  _this._valueItemsDuringOnChange = null;
@@ -75,19 +81,18 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
75
81
  _this.base = new DropDownBase(_this);
76
82
  _this._tags = [];
77
83
  _this._input = null;
84
+ _this._adaptiveInput = null;
78
85
  _this._skipFocusEvent = false;
86
+ _this.itemHeight = 0;
79
87
  _this.scrollToFocused = false;
80
- /**
81
- * @hidden
82
- */
88
+ _this.localization = null;
89
+ /** @hidden */
83
90
  _this.focus = function () {
84
91
  if (_this._input) {
85
92
  _this._input.focus();
86
93
  }
87
94
  };
88
- /**
89
- * @hidden
90
- */
95
+ /** @hidden */
91
96
  _this.handleItemSelect = function (index, state) {
92
97
  var _a = _this.props, _b = _a.data, data = _b === void 0 ? [] : _b, dataItemKey = _a.dataItemKey, virtual = _a.virtual;
93
98
  var skip = virtual ? virtual.skip : 0;
@@ -114,14 +119,11 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
114
119
  _this.triggerOnChange(newItems, state);
115
120
  _this.base.triggerPageChangeCornerItems(dataItem, state);
116
121
  };
117
- /**
118
- * @hidden
119
- */
122
+ /** @hidden */
120
123
  _this.onTagDelete = function (itemsToRemove, event) {
121
- var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
122
124
  var state = _this.base.initState();
123
125
  state.syntheticEvent = event;
124
- if (opened) {
126
+ if (_this.opened) {
125
127
  _this.base.togglePopup(state);
126
128
  }
127
129
  if (!_this.state.focused) {
@@ -133,9 +135,7 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
133
135
  _this.triggerOnChange(selected, state);
134
136
  _this.applyState(state);
135
137
  };
136
- /**
137
- * @hidden
138
- */
138
+ /** @hidden */
139
139
  _this.itemFocus = function (index, state) {
140
140
  var _a = _this.props, _b = _a.data, data = _b === void 0 ? [] : _b, allowCustom = _a.allowCustom, virtual = _a.virtual;
141
141
  var skip = virtual ? virtual.skip : 0;
@@ -169,20 +169,19 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
169
169
  _this.onChangeHandler = function (event) {
170
170
  var state = _this.base.initState();
171
171
  var value = event.currentTarget.value;
172
- var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
173
172
  state.syntheticEvent = event;
174
173
  if (_this.props.filter === undefined) {
175
174
  state.data.text = value;
176
175
  }
177
176
  state.data.focusedIndex = undefined;
178
- if (!opened) {
177
+ if (!_this.opened) {
179
178
  _this.base.togglePopup(state);
179
+ _this.setState({ currentTreeValue: _this.value });
180
180
  }
181
181
  _this.base.filterChanged(value, state);
182
182
  _this.applyState(state);
183
183
  };
184
184
  _this.clearButtonClick = function (event) {
185
- var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
186
185
  var state = _this.base.initState();
187
186
  state.syntheticEvent = event;
188
187
  event.stopPropagation();
@@ -192,7 +191,7 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
192
191
  if (_this.state.focusedIndex !== undefined) {
193
192
  state.data.focusedIndex = undefined;
194
193
  }
195
- if (opened) {
194
+ if (_this.opened) {
196
195
  _this.base.togglePopup(state);
197
196
  }
198
197
  var text = _this.props.filter !== undefined ? _this.props.filter : _this.state.text;
@@ -207,7 +206,6 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
207
206
  _this.onInputKeyDown = function (event) {
208
207
  var keyCode = event.keyCode;
209
208
  var text = _this.props.filter !== undefined ? _this.props.filter : _this.state.text;
210
- var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
211
209
  var focusedItem = _this.getFocusedState().focusedItem;
212
210
  var state = _this.base.initState();
213
211
  state.syntheticEvent = event;
@@ -222,7 +220,7 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
222
220
  _this.base.togglePopup(state);
223
221
  _this.applyState(state);
224
222
  };
225
- if (opened) {
223
+ if (_this.opened) {
226
224
  if (event.altKey && keyCode === Keys.up) {
227
225
  togglePopup();
228
226
  }
@@ -247,13 +245,36 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
247
245
  togglePopup();
248
246
  }
249
247
  };
250
- _this.renderListContainer = function () {
248
+ _this.listContainerContent = function () {
251
249
  var _a, _b;
250
+ var _c = _this.props, header = _c.header, footer = _c.footer, allowCustom = _c.allowCustom, size = _c.size, _d = _c.data, data = _d === void 0 ? [] : _d, groupStickyHeaderItemRender = _c.groupStickyHeaderItemRender, groupField = _c.groupField, list = _c.list;
251
+ var text = _this.props.filter !== undefined ? _this.props.filter : _this.state.text;
252
+ var focusedType = _this.getFocusedState().focusedType;
253
+ var customItem = allowCustom && text && (React.createElement("div", { className: classNames('k-list', (_a = {},
254
+ _a["k-list-".concat(sizeMap[size] || size)] = size,
255
+ _a)), key: "customitem", onClick: _this.customItemSelect, onMouseDown: preventDefault },
256
+ React.createElement("div", { className: classNames('k-list-item k-custom-item', { 'k-focus': isCustom(focusedType) }), style: { fontStyle: 'italic' } },
257
+ text,
258
+ React.createElement(IconWrap, { name: 'plus', icon: plusIcon, style: { position: 'absolute', right: '0.5em' } }))));
259
+ var group = _this.state.group;
260
+ if (group === undefined && groupField !== undefined) {
261
+ group = getItemValue(data[0], groupField);
262
+ }
263
+ return (React.createElement(React.Fragment, null,
264
+ header && React.createElement("div", { className: "k-list-header" }, header),
265
+ customItem,
266
+ React.createElement("div", { className: classNames('k-list', (_b = {},
267
+ _b["k-list-".concat(_this.mobileMode ? 'lg' : sizeMap[size] || size)] = size,
268
+ _b['k-virtual-list'] = _this.base.vs.enabled,
269
+ _b)) },
270
+ !list && group && React.createElement(GroupStickyHeader, { group: group, groupMode: 'modern', render: groupStickyHeaderItemRender }),
271
+ _this.renderList()),
272
+ footer && React.createElement("div", { className: "k-list-footer" }, footer)));
273
+ };
274
+ _this.renderListContainer = function () {
252
275
  var base = _this.base;
253
- var _c = _this.props, header = _c.header, footer = _c.footer, allowCustom = _c.allowCustom, dir = _c.dir, _d = _c.data, data = _d === void 0 ? [] : _d, size = _c.size;
276
+ var _a = _this.props, dir = _a.dir, _b = _a.data, data = _b === void 0 ? [] : _b;
254
277
  var popupSettings = _this.base.getPopupSettings();
255
- var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
256
- var text = _this.props.filter !== undefined ? _this.props.filter : _this.state.text;
257
278
  var popupWidth = popupSettings.width !== undefined ? popupSettings.width : base.popupWidth;
258
279
  var listContainerProps = {
259
280
  dir: dir !== undefined ? dir : base.dirCalculated,
@@ -263,40 +284,115 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
263
284
  className: popupSettings.className,
264
285
  animate: popupSettings.animate,
265
286
  anchor: _this.element,
266
- show: opened,
287
+ show: _this.opened,
267
288
  onOpen: _this.onPopupOpened,
268
289
  onClose: _this.onPopupClosed,
269
290
  appendTo: popupSettings.appendTo
270
291
  },
271
292
  itemsCount: [data.length, _this.value.length]
272
293
  };
273
- var focusedType = _this.getFocusedState().focusedType;
274
- var customItem = allowCustom && text && (React.createElement("div", { className: classNames('k-list', (_a = {},
275
- _a["k-list-".concat(sizeMap[size] || size)] = size,
276
- _a)), key: "customitem", onClick: _this.customItemSelect, onMouseDown: preventDefault },
277
- React.createElement("div", { className: classNames('k-list-item k-custom-item', { 'k-focus': isCustom(focusedType) }), style: { fontStyle: 'italic' } },
278
- text,
279
- React.createElement(IconWrap, { name: 'plus', icon: plusIcon, style: { position: 'absolute', right: '0.5em' } }))));
280
- return (React.createElement(ListContainer, __assign({}, listContainerProps),
281
- header && React.createElement("div", { className: "k-list-header" }, header),
282
- customItem,
283
- React.createElement("div", { className: classNames('k-list', (_b = {},
284
- _b["k-list-".concat(sizeMap[size] || size)] = size,
285
- _b['k-virtual-list'] = _this.base.vs.enabled,
286
- _b)) }, _this.renderList()),
287
- footer && React.createElement("div", { className: "k-list-footer" }, footer)));
294
+ return (React.createElement(ListContainer, __assign({}, listContainerProps), _this.listContainerContent()));
295
+ };
296
+ _this.renderAdaptiveListContainer = function () {
297
+ var _a = _this.props, adaptiveTitle = _a.adaptiveTitle, filterable = _a.filterable, filter = _a.filter;
298
+ var _b = _this.state.windowWidth, windowWidth = _b === void 0 ? 0 : _b;
299
+ var mobileText = filter !== undefined ? filter : _this.state.text;
300
+ _this.localization = provideLocalizationService(_this);
301
+ var actionSheetProps = {
302
+ adaptiveTitle: adaptiveTitle,
303
+ expand: _this.opened,
304
+ onClose: function (event) { return _this.onCancel(event); },
305
+ windowWidth: windowWidth,
306
+ footer: {
307
+ cancelText: _this.localization.toLanguageString(adaptiveModeFooterCancel, messages[adaptiveModeFooterCancel]),
308
+ onCancel: function (event) { return _this.onCancel(event); },
309
+ applyText: _this.localization.toLanguageString(adaptiveModeFooterApply, messages[adaptiveModeFooterApply]),
310
+ onApply: function (event) { return _this.closePopup(event); }
311
+ }
312
+ };
313
+ return (React.createElement(AdaptiveMode, __assign({}, actionSheetProps),
314
+ React.createElement(ActionSheetContent, { className: '!k-overflow-hidden' },
315
+ filterable && React.createElement(ListFilter, { value: mobileText, ref: function (adaptiveFilter) { return _this._adaptiveInput = adaptiveFilter && adaptiveFilter.input; }, onChange: _this.onChangeHandler, onKeyDown: _this.onInputKeyDown, size: _this.props.size, rounded: _this.props.rounded, fillMode: _this.props.fillMode }),
316
+ _this.listContainerContent())));
317
+ };
318
+ _this.closePopup = function (event) {
319
+ var state = _this.base.initState();
320
+ state.syntheticEvent = event;
321
+ event.stopPropagation();
322
+ if (_this.state.focusedIndex !== undefined) {
323
+ state.data.focusedIndex = undefined;
324
+ }
325
+ if (_this.opened) {
326
+ _this.base.togglePopup(state);
327
+ }
328
+ state.events.push({ type: 'onClose' });
329
+ var text = _this.props.filter !== undefined ? _this.props.filter : _this.state.text;
330
+ if (isPresent(text) && text !== '') {
331
+ _this.base.filterChanged('', state);
332
+ }
333
+ if (_this.state.text) {
334
+ state.data.text = '';
335
+ }
336
+ _this.applyState(state);
337
+ };
338
+ _this.onCancel = function (event) {
339
+ var state = _this.base.initState();
340
+ state.syntheticEvent = event;
341
+ event.stopPropagation();
342
+ if (_this.state.focusedIndex !== undefined) {
343
+ state.data.focusedIndex = undefined;
344
+ }
345
+ if (_this.opened) {
346
+ _this.base.togglePopup(state);
347
+ }
348
+ state.events.push({ type: 'onCancel' });
349
+ var text = _this.props.filter !== undefined ? _this.props.filter : _this.state.text;
350
+ if (isPresent(text) && text !== '') {
351
+ _this.base.filterChanged('', state);
352
+ }
353
+ if (_this.state.text) {
354
+ state.data.text = '';
355
+ }
356
+ _this.applyState(state);
288
357
  };
289
358
  _this.renderList = function () {
290
- var _a = _this.props, _b = _a.data, data = _b === void 0 ? [] : _b, textField = _a.textField, listNoDataRender = _a.listNoDataRender, itemRender = _a.itemRender, dataItemKey = _a.dataItemKey, virtual = _a.virtual;
359
+ var _a = _this.props, _b = _a.data, data = _b === void 0 ? [] : _b, textField = _a.textField, listNoDataRender = _a.listNoDataRender, itemRender = _a.itemRender, groupHeaderItemRender = _a.groupHeaderItemRender, dataItemKey = _a.dataItemKey, virtual = _a.virtual;
291
360
  var vs = _this.base.vs;
292
361
  var skip = virtual ? virtual.skip : 0;
293
- var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
294
362
  var focusedIndex = _this.getFocusedState().focusedIndex;
295
363
  var popupSettings = _this.base.getPopupSettings();
296
364
  var translate = "translateY(".concat(vs.translate, "px)");
297
- return (React.createElement(List, { id: _this.base.listBoxId, show: opened, data: data.slice(), focusedIndex: focusedIndex - skip, value: _this.value, textField: textField, valueField: dataItemKey, optionsGuid: _this.base.guid, listRef: function (list) { vs.list = _this.base.list = list; }, wrapperStyle: { maxHeight: popupSettings.height }, wrapperCssClass: "k-list-content", listStyle: vs.enabled ? { transform: translate } : undefined, key: "listKey", skip: skip, onClick: _this.handleItemClick, itemRender: itemRender, noDataRender: listNoDataRender, onMouseDown: preventDefault, onBlur: _this.handleBlur, onScroll: function (e) {
298
- vs.scrollHandler(e);
299
- }, wrapperRef: vs.scrollerRef, scroller: _this.base.renderScrollElement() }));
365
+ return (React.createElement(List, { id: _this.base.listBoxId, show: _this.opened, data: data.slice(), focusedIndex: focusedIndex - skip, value: _this.value, textField: textField, valueField: dataItemKey, optionsGuid: _this.base.guid, groupField: _this.props.groupField, groupMode: 'modern', listRef: function (list) { vs.list = _this.base.list = list; }, wrapperStyle: _this.mobileMode ? {} : { maxHeight: popupSettings.height }, wrapperCssClass: "k-list-content", listStyle: vs.enabled ? { transform: translate } : undefined, key: "listKey", skip: skip, onClick: _this.handleItemClick, itemRender: itemRender, groupHeaderItemRender: groupHeaderItemRender, noDataRender: listNoDataRender, onMouseDown: preventDefault, onBlur: _this.handleBlur, onScroll: _this.onScroll, wrapperRef: vs.scrollerRef, scroller: _this.base.renderScrollElement() }));
366
+ };
367
+ _this.onScroll = function (event) {
368
+ var _a = _this.base, vs = _a.vs, list = _a.list;
369
+ vs.scrollHandler(event);
370
+ var groupField = _this.props.groupField;
371
+ var _b = _this.props.data, data = _b === void 0 ? [] : _b;
372
+ if (!groupField || !data.length) {
373
+ return;
374
+ }
375
+ if (groupField) {
376
+ var itemHeight = _this.itemHeight =
377
+ _this.itemHeight || (vs.enabled ? vs.itemHeight : (list ? list.children[0].offsetHeight : 0));
378
+ var target = event.target;
379
+ var scrollTop = target.scrollTop - (vs.skip * itemHeight);
380
+ data = _this.base.getGroupedDataModernMode(data, groupField);
381
+ var group = data[0][groupField];
382
+ for (var i = 1; i < data.length; i++) {
383
+ if (itemHeight * i > scrollTop) {
384
+ break;
385
+ }
386
+ if (data[i] && data[i][groupField]) {
387
+ group = data[i][groupField];
388
+ }
389
+ }
390
+ if (group !== _this.state.group) {
391
+ _this.setState({
392
+ group: group
393
+ });
394
+ }
395
+ }
300
396
  };
301
397
  _this.customItemSelect = function (event) {
302
398
  var _a;
@@ -319,17 +415,22 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
319
415
  _this.applyState(state);
320
416
  };
321
417
  _this.handleWrapperClick = function (event) {
322
- var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
323
418
  var input = _this._input;
324
- if (!opened && input) {
419
+ if (!_this.opened && input) {
325
420
  _this.focusElement(input);
326
421
  }
327
422
  var state = _this.base.initState();
328
423
  state.syntheticEvent = event;
329
- if (!_this.state.focused) {
424
+ if (!_this.state.focused && !_this.mobileMode) {
330
425
  state.events.push({ type: 'onFocus' });
331
426
  state.data.focused = true;
332
427
  }
428
+ if (_this.mobileMode) {
429
+ _this.setState({ currentTreeValue: _this.tagsToRender });
430
+ if (_this.mobileMode) {
431
+ window.setTimeout(function () { return _this._adaptiveInput && _this._adaptiveInput.focus(); }, 300);
432
+ }
433
+ }
333
434
  _this.base.togglePopup(state);
334
435
  _this.applyState(state);
335
436
  };
@@ -337,7 +438,7 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
337
438
  var state = _this.base.initState();
338
439
  state.syntheticEvent = event;
339
440
  _this.handleItemSelect(index, state);
340
- if (_this.props.autoClose) {
441
+ if (_this.props.autoClose && !_this.mobileMode) {
341
442
  _this.base.togglePopup(state);
342
443
  }
343
444
  event.stopPropagation();
@@ -347,13 +448,12 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
347
448
  if (!_this.state.focused || _this._skipFocusEvent) {
348
449
  return;
349
450
  }
350
- var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
351
451
  var state = _this.base.initState();
352
452
  var _a = _this.props, allowCustom = _a.allowCustom, filterable = _a.filterable;
353
453
  state.syntheticEvent = event;
354
454
  state.data.focused = false;
355
455
  state.events.push({ type: 'onBlur' });
356
- if (opened) {
456
+ if (_this.opened && !_this.mobileMode) {
357
457
  if (_this.state.opened) {
358
458
  state.data.opened = false;
359
459
  }
@@ -371,7 +471,7 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
371
471
  _this.base.handleFocus(event);
372
472
  };
373
473
  _this.onPopupOpened = function () {
374
- if (_this._input && _this.state.focused) {
474
+ if (_this._input && _this.state.focused && !_this.mobileMode) {
375
475
  _this.focusElement(_this._input);
376
476
  }
377
477
  };
@@ -392,12 +492,59 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
392
492
  validatePackage(packageMetadata);
393
493
  return _this;
394
494
  }
495
+ Object.defineProperty(MultiSelectWithoutContext.prototype, "document", {
496
+ get: function () {
497
+ if (!canUseDOM) {
498
+ return;
499
+ }
500
+ // useful only for user actions
501
+ return (this.element && this.element.ownerDocument) || document;
502
+ },
503
+ enumerable: false,
504
+ configurable: true
505
+ });
395
506
  Object.defineProperty(MultiSelectWithoutContext.prototype, "element", {
507
+ /** @hidden */
508
+ get: function () {
509
+ return this._element;
510
+ },
511
+ enumerable: false,
512
+ configurable: true
513
+ });
514
+ Object.defineProperty(MultiSelectWithoutContext.prototype, "opened", {
515
+ /** @hidden */
516
+ get: function () {
517
+ var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
518
+ return !!opened;
519
+ },
520
+ enumerable: false,
521
+ configurable: true
522
+ });
523
+ Object.defineProperty(MultiSelectWithoutContext.prototype, "tagsToRender", {
524
+ /** @hidden */
525
+ get: function () {
526
+ var _a = this.props, tags = _a.tags, textField = _a.textField;
527
+ var tagsToRender = [];
528
+ if (tags === undefined) {
529
+ this.value.forEach(function (item) {
530
+ tagsToRender.push({ text: getItemValue(item, textField), data: [item] });
531
+ });
532
+ }
533
+ else {
534
+ tagsToRender.push.apply(tagsToRender, tags);
535
+ }
536
+ return tagsToRender;
537
+ },
538
+ enumerable: false,
539
+ configurable: true
540
+ });
541
+ Object.defineProperty(MultiSelectWithoutContext.prototype, "mobileMode", {
396
542
  /**
397
- * @hidden
543
+ * The mobile mode of the ComboBox.
398
544
  */
399
545
  get: function () {
400
- return this._element;
546
+ var isAdaptive = this.state.windowWidth && this.state.windowWidth <= MOBILE_MEDIUM_DEVISE && this.props.adaptive;
547
+ return !!isAdaptive;
401
548
  },
402
549
  enumerable: false,
403
550
  configurable: true
@@ -454,9 +601,7 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
454
601
  configurable: true
455
602
  });
456
603
  Object.defineProperty(MultiSelectWithoutContext.prototype, "required", {
457
- /**
458
- * @hidden
459
- */
604
+ /** @hidden */
460
605
  get: function () {
461
606
  return this.props.required !== undefined
462
607
  ? this.props.required
@@ -474,17 +619,16 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
474
619
  enumerable: false,
475
620
  configurable: true
476
621
  });
477
- /**
478
- * @hidden
479
- */
622
+ /** @hidden */
480
623
  MultiSelectWithoutContext.prototype.componentDidUpdate = function (prevProps, prevState) {
481
- var virtual = this.props.virtual;
624
+ var _a;
625
+ var _b = this.props, virtual = _b.virtual, _c = _b.groupField, groupField = _c === void 0 ? '' : _c;
626
+ var _d = this.props.data, data = _d === void 0 ? [] : _d;
482
627
  var skip = virtual ? virtual.skip : 0;
483
628
  var prevTotal = prevProps.virtual ? prevProps.virtual.total : 0;
484
- var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
485
629
  var prevOpened = prevProps.opened !== undefined ? prevProps.opened : prevState.opened;
486
- var opening = !prevOpened && opened;
487
- var closing = prevOpened && !opened;
630
+ var opening = !prevOpened && this.opened;
631
+ var closing = prevOpened && !this.opened;
488
632
  var popupSettings = this.base.getPopupSettings();
489
633
  if (!popupSettings.animate && closing) {
490
634
  this.onPopupClosed();
@@ -494,40 +638,50 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
494
638
  this.base.vs.reset();
495
639
  }
496
640
  else {
497
- var _a = this.getFocusedState(), focusedItem = _a.focusedItem, focusedIndex = _a.focusedIndex;
641
+ var _e = this.getFocusedState(), focusedItem = _e.focusedItem, focusedIndex = _e.focusedIndex;
642
+ if (groupField !== '') {
643
+ focusedIndex = (_a = this.base.getGroupedDataModernMode(data, groupField)) === null || _a === void 0 ? void 0 : _a.indexOf(focusedItem);
644
+ }
498
645
  if (opening && virtual) {
499
646
  this.base.scrollToVirtualItem(virtual, focusedIndex - skip);
500
647
  }
501
648
  else if (opening && !virtual) {
502
649
  this.base.scrollToItem(focusedIndex);
503
650
  }
504
- else if (opened && prevOpened && focusedItem && this.scrollToFocused) {
651
+ else if (this.opened && prevOpened && focusedItem && this.scrollToFocused) {
505
652
  this.base.scrollToItem(focusedIndex - skip);
506
653
  }
507
654
  }
508
655
  this.scrollToFocused = false;
509
656
  this.setValidity();
510
657
  };
511
- /**
512
- * @hidden
513
- */
658
+ /** @hidden */
514
659
  MultiSelectWithoutContext.prototype.componentDidMount = function () {
660
+ var _a;
661
+ this.observerResize = canUseDOM && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this));
515
662
  this.base.didMount();
516
663
  this.setValidity();
664
+ if (((_a = this.document) === null || _a === void 0 ? void 0 : _a.body) && this.observerResize) {
665
+ this.observerResize.observe(this.document.body);
666
+ }
517
667
  };
518
- /**
519
- * @hidden
520
- */
668
+ /** @hidden */
669
+ MultiSelectWithoutContext.prototype.componentWillUnmount = function () {
670
+ var _a;
671
+ if (((_a = this.document) === null || _a === void 0 ? void 0 : _a.body) && this.observerResize) {
672
+ this.observerResize.disconnect();
673
+ }
674
+ };
675
+ /** @hidden */
521
676
  MultiSelectWithoutContext.prototype.onNavigate = function (state, keyCode) {
522
677
  var _a = this.props, allowCustom = _a.allowCustom, _b = _a.data, data = _b === void 0 ? [] : _b;
523
- var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
524
678
  var text = this.props.filter !== undefined ? this.props.filter : this.state.text;
525
679
  var _c = this.getFocusedState(), focusedType = _c.focusedType, focusedIndex = _c.focusedIndex;
526
680
  var customItem = allowCustom && text;
527
681
  var customItemFocused = isCustom(focusedType);
528
682
  var base = this.base;
529
683
  var vs = base.vs;
530
- if (opened && keyCode === Keys.up && customItemFocused) {
684
+ if (this.opened && keyCode === Keys.up && customItemFocused) {
531
685
  if (this.state.focusedIndex !== undefined) {
532
686
  state.data.focusedIndex = undefined;
533
687
  }
@@ -546,13 +700,11 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
546
700
  }
547
701
  this.applyState(state);
548
702
  };
549
- /**
550
- * @hidden
551
- */
703
+ /** @hidden */
552
704
  MultiSelectWithoutContext.prototype.render = function () {
553
705
  var _a, _b;
554
- var _c = this.props, style = _c.style, className = _c.className, label = _c.label, dir = _c.dir, disabled = _c.disabled, tags = _c.tags, textField = _c.textField, dataItemKey = _c.dataItemKey, virtual = _c.virtual, size = _c.size, rounded = _c.rounded, fillMode = _c.fillMode, loading = _c.loading, filter = _c.filter;
555
- var _d = this.state, text = _d.text, focused = _d.focused, focusedTag = _d.focusedTag;
706
+ var _c = this.props, style = _c.style, className = _c.className, label = _c.label, dir = _c.dir, disabled = _c.disabled, textField = _c.textField, dataItemKey = _c.dataItemKey, virtual = _c.virtual, size = _c.size, rounded = _c.rounded, fillMode = _c.fillMode, loading = _c.loading, filter = _c.filter;
707
+ var _d = this.state, text = _d.text, focused = _d.focused, focusedTag = _d.focusedTag, currentTreeValue = _d.currentTreeValue;
556
708
  var vs = this.base.vs;
557
709
  var id = this.props.id || this._inputId;
558
710
  vs.enabled = virtual !== undefined;
@@ -561,51 +713,44 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
561
713
  vs.total = virtual.total;
562
714
  vs.pageSize = virtual.pageSize;
563
715
  }
564
- var tagsToRender = [];
565
- if (tags === undefined) {
566
- this.value.forEach(function (item) {
567
- tagsToRender.push({ text: getItemValue(item, textField), data: [item] });
568
- });
569
- }
570
- else {
571
- tagsToRender.push.apply(tagsToRender, tags);
572
- }
573
- this.setItems(tagsToRender, this._tags);
716
+ var currentTagsToRender = (this.mobileMode && this.opened) ? currentTreeValue : this.tagsToRender;
717
+ this.setItems(this.tagsToRender, this._tags);
574
718
  var isValid = !this.validityStyles || this.validity.valid;
575
- var clearButton = Boolean(filter !== undefined ? filter : text) || this.value.length > 0;
576
- var component = (React.createElement("div", { ref: this.componentRef, className: classNames('k-multiselect k-input', className, (_a = {},
577
- _a["k-input-".concat(sizeMap[size] || size)] = size,
578
- _a["k-rounded-".concat(roundedMap[rounded] || rounded)] = rounded,
579
- _a["k-input-".concat(fillMode)] = fillMode,
580
- _a['k-focus'] = focused && !disabled,
581
- _a['k-invalid'] = !isValid,
582
- _a['k-disabled'] = disabled,
583
- _a['k-loading'] = loading,
584
- _a['k-required'] = this.required,
585
- _a)), style: !label
586
- ? style
587
- : __assign(__assign({}, style), { width: undefined }), dir: dir, onFocus: this.handleFocus, onBlur: this.handleBlur, onClick: this.handleWrapperClick, onMouseDown: preventDefaultNonInputs },
588
- React.createElement("div", { className: classNames('k-input-values') },
589
- React.createElement("div", { className: classNames('k-chip-list', (_b = {},
590
- _b["k-chip-list-".concat(sizeMap[size] || size)] = size,
591
- _b)), role: "listbox", id: 'tagslist-' + this.base.guid }, tagsToRender.length > 0 && React.createElement(TagList, { tagRender: this.props.tagRender, onTagDelete: this.onTagDelete, data: tagsToRender, guid: this.base.guid, focused: focusedTag ? tagsToRender.find(function (t) { return matchTags(t, focusedTag, dataItemKey); }) : undefined, size: size })),
592
- this.renderSearchbar(id)),
593
- loading && React.createElement(IconWrap, { className: "k-input-loading-icon", name: 'loading' }),
594
- clearButton && React.createElement(ClearButton, { onClick: this.clearButtonClick }),
595
- this.renderListContainer()));
719
+ var clearButton = Boolean(filter !== undefined ? filter : text)
720
+ || (currentTagsToRender && currentTagsToRender.length > 0);
721
+ var component = (React.createElement(React.Fragment, null,
722
+ React.createElement("div", { ref: this.componentRef, className: classNames('k-multiselect k-input', className, (_a = {},
723
+ _a["k-input-".concat(sizeMap[size] || size)] = size,
724
+ _a["k-rounded-".concat(roundedMap[rounded] || rounded)] = rounded,
725
+ _a["k-input-".concat(fillMode)] = fillMode,
726
+ _a['k-focus'] = focused && !disabled,
727
+ _a['k-invalid'] = !isValid,
728
+ _a['k-disabled'] = disabled,
729
+ _a['k-loading'] = loading,
730
+ _a['k-required'] = this.required,
731
+ _a)), style: !label
732
+ ? style
733
+ : __assign(__assign({}, style), { width: undefined }), dir: dir, onFocus: this.handleFocus, onBlur: this.handleBlur, onClick: this.handleWrapperClick, onMouseDown: preventDefaultNonInputs },
734
+ React.createElement("div", { className: classNames('k-input-values') },
735
+ React.createElement("div", { className: classNames('k-chip-list', (_b = {}, _b["k-chip-list-".concat(sizeMap[size] || size)] = size, _b)), role: "listbox", id: 'tagslist-' + this.base.guid }, currentTagsToRender && currentTagsToRender.length > 0 && React.createElement(TagList, { tagRender: this.props.tagRender, onTagDelete: this.onTagDelete, data: currentTagsToRender, guid: this.base.guid, focused: focusedTag ? currentTagsToRender.find(function (t) { return matchTags(t, focusedTag, dataItemKey); }) : undefined, size: size })),
736
+ this.renderSearchBar(id)),
737
+ loading && React.createElement(IconWrap, { className: "k-input-loading-icon", name: 'loading' }),
738
+ clearButton && React.createElement(ClearButton, { onClick: this.clearButtonClick }),
739
+ !this.mobileMode && this.renderListContainer()),
740
+ this.mobileMode && this.renderAdaptiveListContainer()));
596
741
  return label ? (React.createElement(FloatingLabel, { label: label, editorId: id, editorValue: text || getItemValue(this.value[0], textField), editorValid: isValid, editorDisabled: disabled, style: { width: style ? style.width : undefined }, children: component })) : component;
597
742
  };
598
- MultiSelectWithoutContext.prototype.renderSearchbar = function (id) {
599
- var _a = this.state, activedescendant = _a.activedescendant, focusedTag = _a.focusedTag;
743
+ MultiSelectWithoutContext.prototype.renderSearchBar = function (id) {
744
+ var _a = this.state, activedescendant = _a.activedescendant, focusedTag = _a.focusedTag, currentTreeValue = _a.currentTreeValue;
600
745
  var _b = this.props, disabled = _b.disabled, placeholder = _b.placeholder, ariaDescribedBy = _b.ariaDescribedBy;
601
- var text = (this.props.filter !== undefined ? this.props.filter : this.state.text) || '';
602
- var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
746
+ var text = !this.mobileMode && (this.props.filter !== undefined ? this.props.filter : this.state.text) || '';
603
747
  var focusedIndex = this.getFocusedState().focusedIndex;
604
748
  var placeholderToShow = this.value.length === 0 && !text ? placeholder : undefined;
749
+ var adaptivePlaceholder = (currentTreeValue && currentTreeValue.length > 0) ? undefined : placeholder;
605
750
  var ariaActivedescendant = activedescendant === ActiveDescendant.TagsList && focusedTag !== undefined ?
606
751
  "tag-".concat(this.base.guid, "-").concat(focusedTag.text.replace(/\s+/g, '-')) :
607
752
  "option-".concat(this.base.guid, "-").concat(focusedIndex);
608
- return (React.createElement(SearchBar, { id: id, size: Math.max((placeholderToShow || '').length, text.length, 1), tabIndex: this.props.tabIndex, accessKey: this.props.accessKey, placeholder: placeholderToShow, value: text, onChange: this.onChangeHandler, onKeyDown: this.onInputKeyDown, ref: this.searchbarRef, disabled: disabled, expanded: opened, owns: this.base.listBoxId, role: 'combobox', activedescendant: ariaActivedescendant, ariaDescribedBy: "tagslist-".concat(this.base.guid).concat(ariaDescribedBy ? (' ' + ariaDescribedBy) : ''), ariaLabelledBy: this.props.ariaLabelledBy, ariaRequired: this.required }));
753
+ return (React.createElement(SearchBar, { id: id, size: Math.max((placeholderToShow || '').length, text.length, 1), tabIndex: this.props.tabIndex, accessKey: this.props.accessKey, placeholder: this.mobileMode && this.opened ? adaptivePlaceholder : placeholderToShow, value: text, onChange: this.onChangeHandler, onKeyDown: this.onInputKeyDown, ref: this.searchbarRef, disabled: disabled, expanded: this.opened, owns: this.base.listBoxId, role: 'combobox', activedescendant: ariaActivedescendant, ariaDescribedBy: "tagslist-".concat(this.base.guid).concat(ariaDescribedBy ? (' ' + ariaDescribedBy) : ''), ariaLabelledBy: this.props.ariaLabelledBy, ariaRequired: this.required }));
609
754
  };
610
755
  MultiSelectWithoutContext.prototype.onTagsNavigate = function (event, state) {
611
756
  var keyCode = event.keyCode;
@@ -736,18 +881,22 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
736
881
  this.base.applyState(state);
737
882
  this._valueItemsDuringOnChange = null;
738
883
  };
884
+ MultiSelectWithoutContext.prototype.calculateMedia = function (entries) {
885
+ for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
886
+ var entry = entries_1[_i];
887
+ this.setState({ windowWidth: entry.target.clientWidth });
888
+ }
889
+ ;
890
+ };
891
+ ;
739
892
  MultiSelectWithoutContext.displayName = 'MultiSelect';
740
- /**
741
- * @hidden
742
- */
893
+ /** @hidden */
743
894
  MultiSelectWithoutContext.propTypes = __assign(__assign({}, DropDownBase.propTypes), { autoClose: PropTypes.bool, value: PropTypes.arrayOf(PropTypes.any), defaultValue: PropTypes.arrayOf(PropTypes.any), dataItemKey: PropTypes.string, placeholder: PropTypes.string, tags: PropTypes.arrayOf(PropTypes.shape({
744
895
  text: PropTypes.string,
745
896
  data: PropTypes.arrayOf(PropTypes.any)
746
- })), tagRender: PropTypes.func, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string });
747
- /**
748
- * @hidden
749
- */
750
- MultiSelectWithoutContext.defaultProps = __assign(__assign({}, DropDownBase.defaultProps), { autoClose: true, required: false, size: 'medium', rounded: 'medium', fillMode: 'solid' });
897
+ })), tagRender: PropTypes.func, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string, groupField: PropTypes.string, list: PropTypes.any, adaptive: PropTypes.bool, adaptiveTitle: PropTypes.string, onCancel: PropTypes.func });
898
+ /** @hidden */
899
+ MultiSelectWithoutContext.defaultProps = __assign(__assign({}, DropDownBase.defaultProps), { autoClose: true, required: false, size: 'medium', rounded: 'medium', fillMode: 'solid', groupMode: 'modern' });
751
900
  return MultiSelectWithoutContext;
752
901
  }(React.Component));
753
902
  export { MultiSelectWithoutContext };