@progress/kendo-react-dropdowns 5.13.0-dev.202304180747 → 5.13.0-dev.202304200917

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 (57) 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/DropDownTree/DropDownTree.js +81 -26
  12. package/dist/es/DropDownTree/DropDownTreeProps.d.ts +8 -0
  13. package/dist/es/MultiColumnComboBox/MultiColumnComboBox.js +7 -5
  14. package/dist/es/MultiSelect/MultiSelect.d.ts +5 -0
  15. package/dist/es/MultiSelect/MultiSelect.js +51 -10
  16. package/dist/es/MultiSelect/MultiSelectProps.d.ts +22 -0
  17. package/dist/es/common/AdaptiveMode.js +1 -1
  18. package/dist/es/common/DropDownBase.d.ts +1 -0
  19. package/dist/es/common/DropDownBase.js +13 -0
  20. package/dist/es/common/GroupStickyHeader.d.ts +24 -0
  21. package/dist/es/common/GroupStickyHeader.js +34 -0
  22. package/dist/es/common/List.d.ts +5 -1
  23. package/dist/es/common/List.js +9 -2
  24. package/dist/es/common/ListGroupItem.d.ts +33 -0
  25. package/dist/es/common/ListGroupItem.js +33 -0
  26. package/dist/es/common/ListItem.d.ts +4 -0
  27. package/dist/es/common/ListItem.js +3 -3
  28. package/dist/es/package-metadata.js +1 -1
  29. package/dist/npm/AutoComplete/AutoComplete.d.ts +11 -2
  30. package/dist/npm/AutoComplete/AutoComplete.js +60 -9
  31. package/dist/npm/AutoComplete/AutoCompleteProps.d.ts +22 -0
  32. package/dist/npm/ComboBox/ComboBox.d.ts +5 -1
  33. package/dist/npm/ComboBox/ComboBox.js +22 -11
  34. package/dist/npm/ComboBox/ComboBoxProps.d.ts +18 -0
  35. package/dist/npm/DropDownList/DropDownList.d.ts +5 -0
  36. package/dist/npm/DropDownList/DropDownList.js +54 -9
  37. package/dist/npm/DropDownList/DropDownListProps.d.ts +22 -0
  38. package/dist/npm/DropDownTree/DropDownTree.js +80 -25
  39. package/dist/npm/DropDownTree/DropDownTreeProps.d.ts +8 -0
  40. package/dist/npm/MultiColumnComboBox/MultiColumnComboBox.js +7 -5
  41. package/dist/npm/MultiSelect/MultiSelect.d.ts +5 -0
  42. package/dist/npm/MultiSelect/MultiSelect.js +51 -10
  43. package/dist/npm/MultiSelect/MultiSelectProps.d.ts +22 -0
  44. package/dist/npm/common/AdaptiveMode.js +1 -1
  45. package/dist/npm/common/DropDownBase.d.ts +1 -0
  46. package/dist/npm/common/DropDownBase.js +13 -0
  47. package/dist/npm/common/GroupStickyHeader.d.ts +24 -0
  48. package/dist/npm/common/GroupStickyHeader.js +36 -0
  49. package/dist/npm/common/List.d.ts +5 -1
  50. package/dist/npm/common/List.js +9 -2
  51. package/dist/npm/common/ListGroupItem.d.ts +33 -0
  52. package/dist/npm/common/ListGroupItem.js +35 -0
  53. package/dist/npm/common/ListItem.d.ts +4 -0
  54. package/dist/npm/common/ListItem.js +3 -3
  55. package/dist/npm/package-metadata.js +1 -1
  56. package/dist/systemjs/kendo-react-dropdowns.js +1 -1
  57. package/package.json +13 -13
@@ -0,0 +1,33 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Represents the props of the ListGroupItem component.
4
+ */
5
+ export interface ListGroupItemProps {
6
+ /**
7
+ * Specifies the id that will be added to the group header item element.
8
+ */
9
+ id?: string;
10
+ /**
11
+ * The group that will be rendered.
12
+ */
13
+ group?: string;
14
+ /**
15
+ * @hidden
16
+ */
17
+ virtual?: boolean;
18
+ /**
19
+ * @hidden
20
+ * Provides information if the rendered list is a multicolumn popup
21
+ */
22
+ isMultiColumn?: boolean;
23
+ /**
24
+ * Fires when the group header item is about to be rendered. Used to override the default appearance of the group header item.
25
+ */
26
+ render?: (li: React.ReactElement<HTMLLIElement>, itemProps: ListGroupItemProps) => React.ReactNode;
27
+ }
28
+ /**
29
+ * @hidden
30
+ */
31
+ export default class ListGroupItem extends React.Component<ListGroupItemProps, {}> {
32
+ render(): string | number | boolean | React.ReactFragment | JSX.Element | null | undefined;
33
+ }
@@ -0,0 +1,33 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ import * as React from 'react';
17
+ /**
18
+ * @hidden
19
+ */
20
+ var ListGroupItem = /** @class */ (function (_super) {
21
+ __extends(ListGroupItem, _super);
22
+ function ListGroupItem() {
23
+ return _super !== null && _super.apply(this, arguments) || this;
24
+ }
25
+ ListGroupItem.prototype.render = function () {
26
+ var _a = this.props, group = _a.group, virtual = _a.virtual, renderer = _a.render, _b = _a.isMultiColumn, isMultiColumn = _b === void 0 ? false : _b;
27
+ var item = (React.createElement("li", { id: this.props.id, role: "group", className: isMultiColumn ? 'k-table-group-row' : 'k-list-group-item', style: isMultiColumn ? { 'boxSizing': 'inherit' } : { position: virtual ? 'relative' : 'unset' } },
28
+ React.createElement("span", { className: !renderer ? isMultiColumn ? 'k-table-th' : 'k-list-item-text' : undefined }, group)));
29
+ return renderer !== undefined ? renderer.call(undefined, item, this.props) : item;
30
+ };
31
+ return ListGroupItem;
32
+ }(React.Component));
33
+ export default ListGroupItem;
@@ -15,6 +15,10 @@ export interface ListItemProps {
15
15
  * Represents the data item of the list item element.
16
16
  */
17
17
  dataItem: any;
18
+ /**
19
+ * Represents the `classic` or `modern` grouping mode of the DropDowns. Defaults to `classic`.
20
+ */
21
+ groupMode: any;
18
22
  /**
19
23
  * Sets the data item field that represents the item text. If the data contains only primitive values, do not define it.
20
24
  */
@@ -28,14 +28,14 @@ var ListItem = /** @class */ (function (_super) {
28
28
  return _this;
29
29
  }
30
30
  ListItem.prototype.render = function () {
31
- var _a = this.props, selected = _a.selected, group = _a.group, dataItem = _a.dataItem, virtual = _a.virtual, renderer = _a.render;
31
+ var _a = this.props, selected = _a.selected, group = _a.group, dataItem = _a.dataItem, virtual = _a.virtual, groupMode = _a.groupMode, renderer = _a.render;
32
32
  var item = (React.createElement("li", { id: this.props.id, role: "option", "aria-selected": selected, className: classNames('k-list-item', {
33
33
  'k-selected': selected,
34
34
  'k-focus': this.props.focused,
35
- 'k-first': Boolean(group)
35
+ 'k-first': Boolean(group) && groupMode === 'classic'
36
36
  }), onClick: this.handleClick, style: { position: virtual ? 'relative' : 'unset' } },
37
37
  React.createElement("span", { className: 'k-list-item-text' }, getItemValue(dataItem, this.props.textField).toString()),
38
- group !== undefined ? React.createElement("div", { className: "k-list-item-group-label" }, group) : null));
38
+ group !== undefined && groupMode === 'classic' ? React.createElement("div", { className: "k-list-item-group-label" }, group) : null));
39
39
  return renderer !== undefined ? renderer.call(undefined, item, this.props) : item;
40
40
  };
41
41
  return ListItem;
@@ -5,7 +5,7 @@ export var packageMetadata = {
5
5
  name: '@progress/kendo-react-dropdowns',
6
6
  productName: 'KendoReact',
7
7
  productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
8
- publishDate: 1681802673,
8
+ publishDate: 1681980885,
9
9
  version: '',
10
10
  licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
11
11
  };
@@ -27,6 +27,7 @@ export declare class AutoCompleteWithoutContext extends React.Component<AutoComp
27
27
  size: PropTypes.Requireable<"small" | "medium" | "large" | null | undefined>;
28
28
  rounded: PropTypes.Requireable<"small" | "medium" | "full" | "large" | null | undefined>;
29
29
  fillMode: PropTypes.Requireable<"flat" | "outline" | "solid" | null | undefined>;
30
+ groupField: PropTypes.Requireable<string>;
30
31
  suggest: PropTypes.Requireable<NonNullable<string | boolean | null | undefined>>;
31
32
  placeholder: PropTypes.Requireable<string>;
32
33
  value: PropTypes.Requireable<string>;
@@ -39,6 +40,7 @@ export declare class AutoCompleteWithoutContext extends React.Component<AutoComp
39
40
  id: PropTypes.Requireable<string>;
40
41
  ariaLabelledBy: PropTypes.Requireable<string>;
41
42
  ariaDescribedBy: PropTypes.Requireable<string>;
43
+ list: PropTypes.Requireable<any>;
42
44
  opened: PropTypes.Requireable<boolean>;
43
45
  disabled: PropTypes.Requireable<boolean>;
44
46
  dir: PropTypes.Requireable<string>;
@@ -57,7 +59,9 @@ export declare class AutoCompleteWithoutContext extends React.Component<AutoComp
57
59
  popupClass: PropTypes.Requireable<string>;
58
60
  className: PropTypes.Requireable<string>;
59
61
  appendTo: PropTypes.Requireable<any>;
60
- width: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
62
+ width: PropTypes.Requireable<NonNullable<string | number | null | undefined>>; /**
63
+ * @hidden
64
+ */
61
65
  height: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
62
66
  }>>;
63
67
  onOpen: PropTypes.Requireable<(...args: any[]) => any>;
@@ -82,7 +86,9 @@ export declare class AutoCompleteWithoutContext extends React.Component<AutoComp
82
86
  height: string;
83
87
  };
84
88
  required: boolean;
85
- validityStyles: boolean;
89
+ validityStyles: boolean; /**
90
+ * The value of the AutoComplete.
91
+ */
86
92
  };
87
93
  /**
88
94
  * @hidden
@@ -94,6 +100,8 @@ export declare class AutoCompleteWithoutContext extends React.Component<AutoComp
94
100
  private _suggested;
95
101
  private _input;
96
102
  private _valueDuringOnChange?;
103
+ private _isScrolling;
104
+ private itemHeight;
97
105
  constructor(props: AutoCompleteProps);
98
106
  /**
99
107
  * @hidden
@@ -159,6 +167,7 @@ export declare class AutoCompleteWithoutContext extends React.Component<AutoComp
159
167
  private renderSearchBar;
160
168
  private renderListContainer;
161
169
  private renderList;
170
+ private onScroll;
162
171
  private handleItemClick;
163
172
  private onChangeHandler;
164
173
  private clearButtonClick;
@@ -33,6 +33,7 @@ var SearchBar_1 = require("./../common/SearchBar");
33
33
  var ListContainer_1 = require("./../common/ListContainer");
34
34
  var List_1 = require("./../common/List");
35
35
  var DropDownBase_1 = require("../common/DropDownBase");
36
+ var GroupStickyHeader_1 = require("../common/GroupStickyHeader");
36
37
  var utils_1 = require("../common/utils");
37
38
  var kendo_react_common_1 = require("@progress/kendo-react-common");
38
39
  var kendo_react_labels_1 = require("@progress/kendo-react-labels");
@@ -55,6 +56,8 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
55
56
  _this._inputId = (0, kendo_react_common_1.guid)();
56
57
  _this._suggested = '';
57
58
  _this._input = null;
59
+ _this._isScrolling = false;
60
+ _this.itemHeight = 0;
58
61
  /**
59
62
  * @hidden
60
63
  */
@@ -94,6 +97,36 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
94
97
  : _this.props.validationMessage || VALIDATION_MESSAGE);
95
98
  }
96
99
  };
100
+ _this.onScroll = function (event) {
101
+ _this._isScrolling = true;
102
+ var list = _this.base.list;
103
+ var groupField = _this.props.groupField;
104
+ var _a = _this.props.data, data = _a === void 0 ? [] : _a;
105
+ if (!groupField || !data.length) {
106
+ return;
107
+ }
108
+ var itemHeight = _this.itemHeight || (list ? list.children[0].offsetHeight : 0);
109
+ var target = event.target;
110
+ var scrollTop = target.scrollTop;
111
+ if (groupField) {
112
+ data = _this.base.getGroupedDataModernMode(data, groupField);
113
+ }
114
+ ;
115
+ var group = data[0][groupField];
116
+ for (var i = 1; i < data.length; i++) {
117
+ if (itemHeight * i > scrollTop) {
118
+ break;
119
+ }
120
+ if (data[i] && data[i][groupField]) {
121
+ group = data[i][groupField];
122
+ }
123
+ }
124
+ if (group !== _this.state.group) {
125
+ _this.setState({
126
+ group: group
127
+ });
128
+ }
129
+ };
97
130
  _this.handleItemClick = function (index, event) {
98
131
  _this.base.handleItemClick(index, event);
99
132
  _this._valueDuringOnChange = undefined;
@@ -152,6 +185,9 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
152
185
  _this.applyState(state);
153
186
  };
154
187
  _this.onInputKeyDown = function (event) {
188
+ if (_this._isScrolling) {
189
+ _this._isScrolling = false;
190
+ }
155
191
  var keyCode = event.keyCode;
156
192
  var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
157
193
  var state = _this.base.initState();
@@ -271,8 +307,9 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
271
307
  * @hidden
272
308
  */
273
309
  AutoCompleteWithoutContext.prototype.componentDidUpdate = function (prevProps, prevState) {
274
- var _a = this.props.data, data = _a === void 0 ? [] : _a;
275
- var _b = prevProps.data, prevData = _b === void 0 ? [] : _b;
310
+ var _a;
311
+ var _b = this.props, _c = _b.groupField, groupField = _c === void 0 ? '' : _c, _d = _b.data, data = _d === void 0 ? [] : _d;
312
+ var _e = prevProps.data, prevData = _e === void 0 ? [] : _e;
276
313
  var focusedIndex = this.focusedIndex();
277
314
  var focusedItem = data[focusedIndex];
278
315
  var dataChanged = prevData !== data;
@@ -280,8 +317,16 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
280
317
  var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
281
318
  var prevOpened = prevProps.opened !== undefined ? prevProps.opened : prevState.opened;
282
319
  var opening = !prevOpened && opened;
283
- if ((opened && (focusedItemChanged || dataChanged)) || opening) {
284
- this.base.scrollToItem(focusedIndex);
320
+ if (groupField === '') {
321
+ if ((opened && (focusedItemChanged || dataChanged)) || opening) {
322
+ this.base.scrollToItem(focusedIndex);
323
+ }
324
+ }
325
+ else if (!this._isScrolling) {
326
+ var focusedItemIndex = (_a = this.base.getGroupedDataModernMode(data, groupField)) === null || _a === void 0 ? void 0 : _a.indexOf(focusedItem);
327
+ if (opened && prevOpened && focusedItemChanged) {
328
+ this.base.scrollToItem(focusedItemIndex);
329
+ }
285
330
  }
286
331
  this.setValidity();
287
332
  };
@@ -378,10 +423,14 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
378
423
  AutoCompleteWithoutContext.prototype.renderListContainer = function () {
379
424
  var _a;
380
425
  var base = this.base;
381
- var _b = this.props, dir = _b.dir, header = _b.header, footer = _b.footer, _c = _b.data, data = _c === void 0 ? [] : _c, size = _b.size;
426
+ var _b = this.props, dir = _b.dir, header = _b.header, footer = _b.footer, _c = _b.data, data = _c === void 0 ? [] : _c, size = _b.size, groupField = _b.groupField, list = _b.list, groupStickyHeaderItemRender = _b.groupStickyHeaderItemRender;
382
427
  var popupSettings = base.getPopupSettings();
383
428
  var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
384
429
  var popupWidth = popupSettings.width !== undefined ? popupSettings.width : base.popupWidth;
430
+ var group = this.state.group;
431
+ if (group === undefined && groupField !== undefined) {
432
+ group = (0, utils_1.getItemValue)(data[0], groupField);
433
+ }
385
434
  return (React.createElement(ListContainer_1.default, { width: popupWidth, popupSettings: {
386
435
  animate: popupSettings.animate,
387
436
  anchor: this.element,
@@ -393,16 +442,18 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
393
442
  header && React.createElement("div", { className: "k-list-header" }, header),
394
443
  React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-list', (_a = {},
395
444
  _a["k-list-".concat(sizeMap[size] || size)] = size,
396
- _a)) }, this.renderList()),
445
+ _a)) },
446
+ !list && group && React.createElement(GroupStickyHeader_1.default, { group: group, groupMode: 'modern', render: groupStickyHeaderItemRender }),
447
+ this.renderList()),
397
448
  footer && React.createElement("div", { className: "k-list-footer" }, footer)));
398
449
  };
399
450
  AutoCompleteWithoutContext.prototype.renderList = function () {
400
451
  var base = this.base;
401
452
  var popupSettings = base.getPopupSettings();
402
- var _a = this.props, textField = _a.textField, _b = _a.data, data = _b === void 0 ? [] : _b, listNoDataRender = _a.listNoDataRender, itemRender = _a.itemRender;
453
+ var _a = this.props, textField = _a.textField, _b = _a.data, data = _b === void 0 ? [] : _b, listNoDataRender = _a.listNoDataRender, itemRender = _a.itemRender, groupHeaderItemRender = _a.groupHeaderItemRender;
403
454
  var value = this.value;
404
455
  var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
405
- return (React.createElement(List_1.default, { id: base.listBoxId, show: opened, data: data.slice(), focusedIndex: this.focusedIndex(), value: value, textField: textField, valueField: textField, highlightSelected: false, optionsGuid: base.guid, listRef: function (list) { return base.list = list; }, wrapperStyle: { maxHeight: popupSettings.height }, wrapperCssClass: "k-list-content", onClick: this.handleItemClick, itemRender: itemRender, noDataRender: listNoDataRender, onMouseDown: function (e) { return e.preventDefault(); } }));
456
+ return (React.createElement(List_1.default, { id: base.listBoxId, show: opened, data: data.slice(), focusedIndex: this.focusedIndex(), value: value, textField: textField, valueField: textField, highlightSelected: false, optionsGuid: base.guid, groupField: this.props.groupField, groupMode: 'modern', listRef: function (list) { return base.list = list; }, wrapperStyle: { maxHeight: popupSettings.height }, wrapperCssClass: "k-list-content", onClick: this.handleItemClick, itemRender: itemRender, groupHeaderItemRender: groupHeaderItemRender, noDataRender: listNoDataRender, onMouseDown: function (e) { return e.preventDefault(); }, onScroll: this.onScroll }));
406
457
  };
407
458
  AutoCompleteWithoutContext.prototype.triggerOnChange = function (newValue, state, eventArgs) {
408
459
  if (this.value === newValue && !eventArgs) {
@@ -442,7 +493,7 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
442
493
  /**
443
494
  * @hidden
444
495
  */
445
- AutoCompleteWithoutContext.propTypes = __assign(__assign({}, DropDownBase_1.default.basicPropTypes), { size: PropTypes.oneOf([null, 'small', 'medium', 'large']), rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']), fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline']), suggest: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), placeholder: PropTypes.string, value: PropTypes.string, defaultValue: PropTypes.string, validationMessage: PropTypes.string, required: PropTypes.bool, readonly: PropTypes.bool, clearButton: PropTypes.bool, valueRender: PropTypes.func, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string });
496
+ AutoCompleteWithoutContext.propTypes = __assign(__assign({}, DropDownBase_1.default.basicPropTypes), { size: PropTypes.oneOf([null, 'small', 'medium', 'large']), rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']), fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline']), groupField: PropTypes.string, suggest: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), placeholder: PropTypes.string, value: PropTypes.string, defaultValue: PropTypes.string, validationMessage: PropTypes.string, required: PropTypes.bool, readonly: PropTypes.bool, clearButton: PropTypes.bool, valueRender: PropTypes.func, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string, list: PropTypes.any });
446
497
  /**
447
498
  * @hidden
448
499
  */
@@ -2,6 +2,8 @@
2
2
  import { AutoComplete } from './AutoComplete';
3
3
  import { ChangeEvent, OpenEvent, CloseEvent, FocusEvent, BlurEvent } from './../common/events';
4
4
  import { DropDownsPopupSettings, Suggestion } from '../common/settings';
5
+ import { ListGroupItemProps } from '../common/ListGroupItem';
6
+ import { GroupStickyHeaderProps } from '../common/GroupStickyHeader';
5
7
  import { ListItemProps } from '../common/ListItem';
6
8
  import { FormComponentProps } from '@progress/kendo-react-common';
7
9
  /**
@@ -214,4 +216,24 @@ export interface AutoCompleteProps extends FormComponentProps {
214
216
  * @default `solid`
215
217
  */
216
218
  fillMode?: null | 'solid' | 'flat' | 'outline';
219
+ /**
220
+ * Sets the data item field that represents the start of a group. Applicable to objects data.
221
+ */
222
+ groupField?: string;
223
+ /**
224
+ * Fires when a AutoComplete group header item is about to be rendered. Used to override the default appearance of the group's headers.
225
+ */
226
+ groupHeaderItemRender?: (li: React.ReactElement<HTMLLIElement>, itemProps: ListGroupItemProps) => React.ReactNode;
227
+ /**
228
+ * Fires when a AutoComplete sticky group header item is about to be rendered. Used to override the default appearance of the sticky group header of the component.
229
+ */
230
+ groupStickyHeaderItemRender?: (div: React.ReactElement<HTMLDivElement>, stickyHeaderProps: GroupStickyHeaderProps) => React.ReactNode;
231
+ /**
232
+ * @hidden
233
+ */
234
+ list?: any;
235
+ /**
236
+ * Sets the key for comparing the data items of the AutoComplete. If `dataItemKey` is not set, the AutoComplete compares the items by reference.
237
+ */
238
+ dataItemKey?: string;
217
239
  }
@@ -25,6 +25,8 @@ export declare class ComboBoxWithoutContext extends React.Component<ComboBoxProp
25
25
  fillMode: PropTypes.Requireable<"flat" | "outline" | "solid" | null | undefined>;
26
26
  dataItemKey: PropTypes.Requireable<string>;
27
27
  groupField: PropTypes.Requireable<string>;
28
+ groupMode: PropTypes.Requireable<string | undefined>;
29
+ isMultiColumn: PropTypes.Requireable<boolean>;
28
30
  suggest: PropTypes.Requireable<boolean>;
29
31
  placeholder: PropTypes.Requireable<string>;
30
32
  allowCustom: PropTypes.Requireable<boolean>;
@@ -56,7 +58,7 @@ export declare class ComboBoxWithoutContext extends React.Component<ComboBoxProp
56
58
  opened: PropTypes.Requireable<boolean>;
57
59
  disabled: PropTypes.Requireable<boolean>;
58
60
  dir: PropTypes.Requireable<string>;
59
- tabIndex: PropTypes.Requireable<number>;
61
+ tabIndex: PropTypes.Requireable<number>; /** @hidden */
60
62
  accessKey: PropTypes.Requireable<string>;
61
63
  data: PropTypes.Requireable<any[]>;
62
64
  textField: PropTypes.Requireable<string>;
@@ -93,6 +95,8 @@ export declare class ComboBoxWithoutContext extends React.Component<ComboBoxProp
93
95
  allowCustom: boolean;
94
96
  clearButton: boolean;
95
97
  required: boolean;
98
+ groupMode: string | undefined;
99
+ isMultiColumn: boolean;
96
100
  popupSettings: {
97
101
  height: string;
98
102
  };
@@ -37,6 +37,7 @@ var SearchBar_1 = require("../common/SearchBar");
37
37
  var ListContainer_1 = require("../common/ListContainer");
38
38
  var List_1 = require("../common/List");
39
39
  var ListFilter_1 = require("../common/ListFilter");
40
+ var GroupStickyHeader_1 = require("../common/GroupStickyHeader");
40
41
  var kendo_react_common_2 = require("@progress/kendo-react-common");
41
42
  var package_metadata_1 = require("../package-metadata");
42
43
  var ClearButton_1 = require("../common/ClearButton");
@@ -123,7 +124,8 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
123
124
  _this.onScroll = function (event) {
124
125
  var _a = _this.base, vs = _a.vs, list = _a.list;
125
126
  vs.scrollHandler(event);
126
- var _b = _this.props, _c = _b.data, data = _c === void 0 ? [] : _c, groupField = _b.groupField;
127
+ var groupField = _this.props.groupField;
128
+ var _b = _this.props.data, data = _b === void 0 ? [] : _b;
127
129
  if (!groupField || !data.length) {
128
130
  return;
129
131
  }
@@ -131,6 +133,9 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
131
133
  _this.itemHeight || (vs.enabled ? vs.itemHeight : (list ? list.children[0].offsetHeight : 0));
132
134
  var target = event.target;
133
135
  var scrollTop = target.scrollTop - (vs.skip * itemHeight);
136
+ if (_this.props.groupMode === 'modern') {
137
+ data = _this.base.getGroupedDataModernMode(data, groupField);
138
+ }
134
139
  var group = data[0][groupField];
135
140
  for (var i = 1; i < data.length; i++) {
136
141
  if (itemHeight * i > scrollTop) {
@@ -381,7 +386,9 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
381
386
  });
382
387
  /** @hidden */
383
388
  ComboBoxWithoutContext.prototype.componentDidUpdate = function (prevProps, prevState) {
384
- var _a = this.props, _b = _a.data, data = _b === void 0 ? [] : _b, dataItemKey = _a.dataItemKey, virtual = _a.virtual;
389
+ var _a;
390
+ var _b = this.props, dataItemKey = _b.dataItemKey, virtual = _b.virtual, _c = _b.groupField, groupField = _c === void 0 ? '' : _c;
391
+ var _d = this.props.data, data = _d === void 0 ? [] : _d;
385
392
  var prevTotal = prevProps.virtual ? prevProps.virtual.total : 0;
386
393
  var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
387
394
  var prevOpened = prevProps.opened !== undefined ? prevProps.opened : prevState.opened;
@@ -395,6 +402,10 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
395
402
  else {
396
403
  var prevSelectedItem = prevProps.value !== undefined ? prevProps.value : prevState.value;
397
404
  var selectedItemIndex = data.findIndex(function (i) { return (0, utils_1.areSame)(i, selectedItem, dataItemKey); });
405
+ // Needed to calculate the proper item index when in 'modern' grouping mode
406
+ if (this.props.groupMode === 'modern') {
407
+ selectedItemIndex = (_a = this.base.getGroupedDataModernMode(data, groupField)) === null || _a === void 0 ? void 0 : _a.indexOf(selectedItem);
408
+ }
398
409
  var selectedItemChanged = !(0, utils_1.areSame)(prevSelectedItem, selectedItem, dataItemKey);
399
410
  if (opening && virtual) {
400
411
  this.base.scrollToVirtualItem(virtual, selectedItemIndex);
@@ -585,7 +596,7 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
585
596
  var _a;
586
597
  var _this = this;
587
598
  var _b = this.state.windowWidth, windowWidth = _b === void 0 ? 0 : _b;
588
- var _c = this.props, header = _c.header, footer = _c.footer, size = _c.size, _d = _c.data, data = _d === void 0 ? [] : _d, groupField = _c.groupField, list = _c.list, virtual = _c.virtual, adaptiveTitle = _c.adaptiveTitle;
599
+ var _c = this.props, header = _c.header, footer = _c.footer, size = _c.size, _d = _c.data, data = _d === void 0 ? [] : _d, groupField = _c.groupField, groupMode = _c.groupMode, list = _c.list, virtual = _c.virtual, adaptiveTitle = _c.adaptiveTitle, groupStickyHeaderItemRender = _c.groupStickyHeaderItemRender;
589
600
  var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
590
601
  var group = this.state.group;
591
602
  if (group === undefined && groupField !== undefined) {
@@ -621,14 +632,14 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
621
632
  _a["k-table-".concat(sizeMap[size] || size)] = list && size,
622
633
  _a)) },
623
634
  header && React.createElement("div", { className: "k-table-header" }, header),
624
- !list && group && React.createElement("div", { className: "k-list-group-sticky-header" }, group),
635
+ !list && group && React.createElement(GroupStickyHeader_1.default, { group: group, groupMode: groupMode, render: groupStickyHeaderItemRender }),
625
636
  this.renderList(),
626
637
  footer && React.createElement("div", { className: "k-list-footer" }, footer)))))));
627
638
  };
628
639
  ComboBoxWithoutContext.prototype.renderListContainer = function () {
629
640
  var _a;
630
641
  var base = this.base;
631
- var _b = this.props, dir = _b.dir, header = _b.header, footer = _b.footer, _c = _b.data, data = _c === void 0 ? [] : _c, groupField = _b.groupField, size = _b.size, list = _b.list, virtual = _b.virtual;
642
+ var _b = this.props, dir = _b.dir, header = _b.header, footer = _b.footer, _c = _b.data, data = _c === void 0 ? [] : _c, groupField = _b.groupField, groupMode = _b.groupMode, size = _b.size, list = _b.list, virtual = _b.virtual, groupStickyHeaderItemRender = _b.groupStickyHeaderItemRender;
632
643
  var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
633
644
  var popupSettings = base.getPopupSettings();
634
645
  var popupWidth = popupSettings.width !== undefined ? popupSettings.width : base.popupWidth;
@@ -652,7 +663,7 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
652
663
  _a["k-table-".concat(sizeMap[size] || size)] = list && size,
653
664
  _a)) },
654
665
  header && React.createElement("div", { className: "k-table-header" }, header),
655
- !list && group && React.createElement("div", { className: "k-list-group-sticky-header" }, group),
666
+ !list && group && React.createElement(GroupStickyHeader_1.default, { group: group, groupMode: groupMode, render: groupStickyHeaderItemRender }),
656
667
  this.renderList(),
657
668
  footer && React.createElement("div", { className: "k-list-footer" }, footer))));
658
669
  };
@@ -660,7 +671,7 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
660
671
  var _a;
661
672
  var _this = this;
662
673
  var base = this.base;
663
- var _b = this.props, textField = _b.textField, dataItemKey = _b.dataItemKey, listNoDataRender = _b.listNoDataRender, itemRender = _b.itemRender, _c = _b.data, data = _c === void 0 ? [] : _c, _d = _b.virtual, virtual = _d === void 0 ? { skip: 0 } : _d;
674
+ var _b = this.props, textField = _b.textField, dataItemKey = _b.dataItemKey, listNoDataRender = _b.listNoDataRender, itemRender = _b.itemRender, groupHeaderItemRender = _b.groupHeaderItemRender, _c = _b.data, data = _c === void 0 ? [] : _c, _d = _b.virtual, virtual = _d === void 0 ? { skip: 0 } : _d;
664
675
  var popupSettings = base.getPopupSettings();
665
676
  var vs = base.vs;
666
677
  var skip = virtual.skip;
@@ -671,11 +682,11 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
671
682
  var selectedItemText = (0, utils_1.getItemValue)(this.value, textField);
672
683
  var value = (0, utils_1.isPresent)(text) && text !== selectedItemText ? null : this.value;
673
684
  var ListComponent = this.props.list || List_1.default;
674
- return (React.createElement(ListComponent, { id: base.listBoxId, virtual: Boolean(virtual), show: opened, data: data, focusedIndex: focusedIndex, value: value, textField: textField, valueField: dataItemKey, groupField: this.props.groupField, optionsGuid: base.guid, listRef: function (list) { vs.list = _this.base.list = list; _this.itemHeight = 0; }, wrapperStyle: (this.state.windowWidth && this.state.windowWidth > constants_1.MOBILE_MEDIUM_DEVISE)
685
+ return (React.createElement(ListComponent, { id: base.listBoxId, virtual: Boolean(virtual), show: opened, data: data, focusedIndex: focusedIndex, value: value, textField: textField, valueField: dataItemKey, groupField: this.props.groupField, groupMode: this.props.groupMode, isMultiColumn: this.props.isMultiColumn, optionsGuid: base.guid, listRef: function (list) { vs.list = _this.base.list = list; _this.itemHeight = 0; }, wrapperStyle: (this.state.windowWidth && this.state.windowWidth > constants_1.MOBILE_MEDIUM_DEVISE)
675
686
  ? { maxHeight: popupSettings.height }
676
687
  : {}, wrapperCssClass: (0, kendo_react_common_1.classNames)('k-list-content', (_a = {},
677
688
  _a['k-list-scroller'] = !virtual,
678
- _a)), listStyle: vs.enabled ? { transform: translate } : undefined, key: "listkey", skip: skip, onClick: this.handleItemClick, itemRender: itemRender, noDataRender: listNoDataRender, onMouseDown: function (e) { return e.preventDefault(); }, onScroll: this.onScroll, wrapperRef: vs.scrollerRef, scroller: this.base.renderScrollElement() }));
689
+ _a)), listStyle: vs.enabled ? { transform: translate } : undefined, key: "listkey", skip: skip, onClick: this.handleItemClick, itemRender: itemRender, groupHeaderItemRender: groupHeaderItemRender, noDataRender: listNoDataRender, onMouseDown: function (e) { return e.preventDefault(); }, onScroll: this.onScroll, wrapperRef: vs.scrollerRef, scroller: this.base.renderScrollElement() }));
679
690
  };
680
691
  ComboBoxWithoutContext.prototype.renderSearchBar = function (text, id, placeholder) {
681
692
  var _this = this;
@@ -731,9 +742,9 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
731
742
  ;
732
743
  ComboBoxWithoutContext.displayName = 'ComboBox';
733
744
  /** @hidden */
734
- ComboBoxWithoutContext.propTypes = __assign(__assign({}, DropDownBase_1.default.propTypes), { size: PropTypes.oneOf([null, 'small', 'medium', 'large']), rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']), fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline']), dataItemKey: PropTypes.string, groupField: PropTypes.string, suggest: PropTypes.bool, placeholder: PropTypes.string, allowCustom: PropTypes.bool, clearButton: PropTypes.bool, iconClassName: PropTypes.string, svgIcon: kendo_react_common_1.svgIconPropType, validationMessage: PropTypes.string, required: PropTypes.bool, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string, list: PropTypes.any, valueRender: PropTypes.func });
745
+ ComboBoxWithoutContext.propTypes = __assign(__assign({}, DropDownBase_1.default.propTypes), { size: PropTypes.oneOf([null, 'small', 'medium', 'large']), rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']), fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline']), dataItemKey: PropTypes.string, groupField: PropTypes.string, groupMode: PropTypes.oneOf([undefined, 'classic', 'modern']), isMultiColumn: PropTypes.bool, suggest: PropTypes.bool, placeholder: PropTypes.string, allowCustom: PropTypes.bool, clearButton: PropTypes.bool, iconClassName: PropTypes.string, svgIcon: kendo_react_common_1.svgIconPropType, validationMessage: PropTypes.string, required: PropTypes.bool, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string, list: PropTypes.any, valueRender: PropTypes.func });
735
746
  /** @hidden */
736
- ComboBoxWithoutContext.defaultProps = __assign(__assign({}, DropDownBase_1.default.defaultProps), { size: 'medium', rounded: 'medium', fillMode: 'solid', allowCustom: false, clearButton: true, required: false });
747
+ ComboBoxWithoutContext.defaultProps = __assign(__assign({}, DropDownBase_1.default.defaultProps), { size: 'medium', rounded: 'medium', fillMode: 'solid', allowCustom: false, clearButton: true, required: false, groupMode: 'classic', isMultiColumn: false });
737
748
  return ComboBoxWithoutContext;
738
749
  }(React.Component));
739
750
  exports.ComboBoxWithoutContext = ComboBoxWithoutContext;
@@ -4,6 +4,8 @@ import { FilterChangeEvent, ChangeEvent, OpenEvent, CloseEvent, FocusEvent, Blur
4
4
  import { FormComponentProps, SVGIcon } from '@progress/kendo-react-common';
5
5
  import { VirtualizationSettings, DropDownsPopupSettings } from '../common/settings';
6
6
  import { ListItemProps } from '../common/ListItem';
7
+ import { ListGroupItemProps } from '../common/ListGroupItem';
8
+ import { GroupStickyHeaderProps } from '../common/GroupStickyHeader';
7
9
  /**
8
10
  * Represents the object of the `FilterChange` ComboBox event.
9
11
  */
@@ -131,6 +133,14 @@ export interface ComboBoxProps extends FormComponentProps {
131
133
  * Sets the data item field that represents the start of a group. Applicable to objects data.
132
134
  */
133
135
  groupField?: string;
136
+ /**
137
+ * Defines the `classic` or `modern` type of the grouping's visualization. Defaults to `classic`.
138
+ */
139
+ groupMode?: string;
140
+ /**
141
+ * @hidden Used to indicate if the ComboBox is with multiple columns
142
+ */
143
+ isMultiColumn?: boolean;
134
144
  /**
135
145
  * Sets the key for comparing the data items of the ComboBox. If `dataItemKey` is not set, the ComboBox compares the items by reference ([see example]({% slug binding_combobox %}#toc-datasets-of-objects)).
136
146
  */
@@ -213,6 +223,14 @@ export interface ComboBoxProps extends FormComponentProps {
213
223
  * Fires when a ComboBox list item is about to be rendered ([see example]({% slug customrendering_combobox %}#toc-items)). Used to override the default appearance of the list items.
214
224
  */
215
225
  itemRender?: (li: React.ReactElement<HTMLLIElement>, itemProps: ListItemProps) => React.ReactNode;
226
+ /**
227
+ * Fires when a ComboBox group header item is about to be rendered. Used to override the default appearance of the group's headers when the component is configured in `modern` group mode.
228
+ */
229
+ groupHeaderItemRender?: (li: React.ReactElement<HTMLLIElement>, itemProps: ListGroupItemProps) => React.ReactNode;
230
+ /**
231
+ * Fires when a ComboBox sticky group header item is about to be rendered. Used to override the default appearance of the sticky group header of the component.
232
+ */
233
+ groupStickyHeaderItemRender?: (div: React.ReactElement<HTMLDivElement>, stickyHeaderProps: GroupStickyHeaderProps) => React.ReactNode;
216
234
  /**
217
235
  * Fires when the element which indicates no data in the popup is about to be rendered. Used to override the default appearance of the element.
218
236
  */
@@ -80,6 +80,8 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
80
80
  ariaLabel: PropTypes.Requireable<string>;
81
81
  leftRightKeysNavigation: PropTypes.Requireable<boolean>;
82
82
  title: PropTypes.Requireable<string>;
83
+ groupField: PropTypes.Requireable<string>;
84
+ list: PropTypes.Requireable<any>;
83
85
  };
84
86
  /**
85
87
  * @hidden
@@ -89,6 +91,7 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
89
91
  size: "small" | "medium" | "large" | null | undefined;
90
92
  rounded: "small" | "medium" | "full" | "large" | null | undefined;
91
93
  fillMode: "flat" | "outline" | "solid" | null | undefined;
94
+ groupMode: string | undefined;
92
95
  popupSettings: {
93
96
  height: string;
94
97
  };
@@ -111,6 +114,7 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
111
114
  private _valueDuringOnChange;
112
115
  private _navigated;
113
116
  private _inputId;
117
+ private itemHeight;
114
118
  private observerResize?;
115
119
  private get document();
116
120
  constructor(props: DropDownListProps);
@@ -170,6 +174,7 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
170
174
  private renderAdaptiveListContainer;
171
175
  private renderListContainer;
172
176
  private renderList;
177
+ private onScroll;
173
178
  private renderListFilter;
174
179
  private renderDefaultItem;
175
180
  private search;