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