@progress/kendo-react-dropdowns 5.13.0-dev.202304200559 → 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.
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/dist/es/AutoComplete/AutoComplete.d.ts +11 -2
- package/dist/es/AutoComplete/AutoComplete.js +60 -9
- package/dist/es/AutoComplete/AutoCompleteProps.d.ts +22 -0
- package/dist/es/ComboBox/ComboBox.d.ts +5 -1
- package/dist/es/ComboBox/ComboBox.js +22 -11
- package/dist/es/ComboBox/ComboBoxProps.d.ts +18 -0
- package/dist/es/DropDownList/DropDownList.d.ts +5 -0
- package/dist/es/DropDownList/DropDownList.js +54 -9
- package/dist/es/DropDownList/DropDownListProps.d.ts +22 -0
- package/dist/es/MultiColumnComboBox/MultiColumnComboBox.js +7 -5
- package/dist/es/MultiSelect/MultiSelect.d.ts +5 -0
- package/dist/es/MultiSelect/MultiSelect.js +51 -10
- package/dist/es/MultiSelect/MultiSelectProps.d.ts +22 -0
- package/dist/es/common/DropDownBase.d.ts +1 -0
- package/dist/es/common/DropDownBase.js +13 -0
- package/dist/es/common/GroupStickyHeader.d.ts +24 -0
- package/dist/es/common/GroupStickyHeader.js +34 -0
- package/dist/es/common/List.d.ts +5 -1
- package/dist/es/common/List.js +9 -2
- package/dist/es/common/ListGroupItem.d.ts +33 -0
- package/dist/es/common/ListGroupItem.js +33 -0
- package/dist/es/common/ListItem.d.ts +4 -0
- package/dist/es/common/ListItem.js +3 -3
- package/dist/es/package-metadata.js +1 -1
- package/dist/npm/AutoComplete/AutoComplete.d.ts +11 -2
- package/dist/npm/AutoComplete/AutoComplete.js +60 -9
- package/dist/npm/AutoComplete/AutoCompleteProps.d.ts +22 -0
- package/dist/npm/ComboBox/ComboBox.d.ts +5 -1
- package/dist/npm/ComboBox/ComboBox.js +22 -11
- package/dist/npm/ComboBox/ComboBoxProps.d.ts +18 -0
- package/dist/npm/DropDownList/DropDownList.d.ts +5 -0
- package/dist/npm/DropDownList/DropDownList.js +54 -9
- package/dist/npm/DropDownList/DropDownListProps.d.ts +22 -0
- package/dist/npm/MultiColumnComboBox/MultiColumnComboBox.js +7 -5
- package/dist/npm/MultiSelect/MultiSelect.d.ts +5 -0
- package/dist/npm/MultiSelect/MultiSelect.js +51 -10
- package/dist/npm/MultiSelect/MultiSelectProps.d.ts +22 -0
- package/dist/npm/common/DropDownBase.d.ts +1 -0
- package/dist/npm/common/DropDownBase.js +13 -0
- package/dist/npm/common/GroupStickyHeader.d.ts +24 -0
- package/dist/npm/common/GroupStickyHeader.js +36 -0
- package/dist/npm/common/List.d.ts +5 -1
- package/dist/npm/common/List.js +9 -2
- package/dist/npm/common/ListGroupItem.d.ts +33 -0
- package/dist/npm/common/ListGroupItem.js +35 -0
- package/dist/npm/common/ListItem.d.ts +4 -0
- package/dist/npm/common/ListItem.js +3 -3
- package/dist/npm/package-metadata.js +1 -1
- package/dist/systemjs/kendo-react-dropdowns.js +1 -1
- package/package.json +13 -13
|
@@ -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
|
|
275
|
-
var _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 (
|
|
284
|
-
|
|
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)) },
|
|
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
|
|
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
|
|
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(
|
|
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(
|
|
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;
|
|
@@ -34,6 +34,7 @@ var kendo_react_labels_1 = require("@progress/kendo-react-labels");
|
|
|
34
34
|
var kendo_svg_icons_1 = require("@progress/kendo-svg-icons");
|
|
35
35
|
var ListContainer_1 = require("../common/ListContainer");
|
|
36
36
|
var ListFilter_1 = require("../common/ListFilter");
|
|
37
|
+
var GroupStickyHeader_1 = require("../common/GroupStickyHeader");
|
|
37
38
|
var ListDefaultItem_1 = require("../common/ListDefaultItem");
|
|
38
39
|
var List_1 = require("../common/List");
|
|
39
40
|
var DropDownBase_1 = require("../common/DropDownBase");
|
|
@@ -66,6 +67,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
66
67
|
_this._filterInput = null;
|
|
67
68
|
_this._navigated = false;
|
|
68
69
|
_this._inputId = (0, kendo_react_common_1.guid)();
|
|
70
|
+
_this.itemHeight = 0;
|
|
69
71
|
/**
|
|
70
72
|
* @hidden
|
|
71
73
|
*/
|
|
@@ -99,7 +101,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
99
101
|
};
|
|
100
102
|
_this.renderListContainer = function () {
|
|
101
103
|
var _a;
|
|
102
|
-
var _b = _this.props, header = _b.header, footer = _b.footer, dir = _b.dir, _c = _b.data, data = _c === void 0 ? [] : _c, size = _b.size;
|
|
104
|
+
var _b = _this.props, header = _b.header, footer = _b.footer, dir = _b.dir, _c = _b.data, data = _c === void 0 ? [] : _c, size = _b.size, groupField = _b.groupField, groupStickyHeaderItemRender = _b.groupStickyHeaderItemRender, list = _b.list;
|
|
103
105
|
var base = _this.base;
|
|
104
106
|
var popupSettings = base.getPopupSettings();
|
|
105
107
|
var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
|
|
@@ -119,24 +121,57 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
119
121
|
},
|
|
120
122
|
itemsCount: [data.length]
|
|
121
123
|
};
|
|
124
|
+
var group = _this.state.group;
|
|
125
|
+
if (group === undefined && groupField !== undefined) {
|
|
126
|
+
group = (0, utils_1.getItemValue)(data[0], groupField);
|
|
127
|
+
}
|
|
122
128
|
return (React.createElement(ListContainer_1.default, __assign({}, listContainerProps),
|
|
123
129
|
_this.renderListFilter(),
|
|
124
130
|
header && React.createElement("div", { className: "k-list-header" }, header),
|
|
125
131
|
React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-list', (_a = {}, _a["k-list-".concat(sizeMap[size] || size)] = size, _a['k-virtual-list'] = _this.base.vs.enabled, _a)) },
|
|
126
132
|
_this.renderDefaultItem(),
|
|
133
|
+
!list && group && React.createElement(GroupStickyHeader_1.default, { group: group, groupMode: 'modern', render: groupStickyHeaderItemRender }),
|
|
127
134
|
_this.renderList()),
|
|
128
135
|
footer && React.createElement("div", { className: "k-list-footer" }, footer)));
|
|
129
136
|
};
|
|
130
137
|
_this.renderList = function () {
|
|
131
|
-
var _a = _this.props, _b = _a.data, data = _b === void 0 ? [] : _b, textField = _a.textField, dataItemKey = _a.dataItemKey, _c = _a.virtual, virtual = _c === void 0 ? { skip: 0 } : _c, listNoDataRender = _a.listNoDataRender, itemRender = _a.itemRender;
|
|
138
|
+
var _a = _this.props, _b = _a.data, data = _b === void 0 ? [] : _b, textField = _a.textField, dataItemKey = _a.dataItemKey, _c = _a.virtual, virtual = _c === void 0 ? { skip: 0 } : _c, groupHeaderItemRender = _a.groupHeaderItemRender, listNoDataRender = _a.listNoDataRender, itemRender = _a.itemRender;
|
|
132
139
|
var vs = _this.base.vs;
|
|
133
140
|
var skip = virtual.skip;
|
|
134
141
|
var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
|
|
135
142
|
var popupSettings = _this.base.getPopupSettings();
|
|
136
143
|
var translate = "translateY(".concat(vs.translate, "px)");
|
|
137
|
-
return (React.createElement(List_1.default, { id: _this.base.listBoxId, show: opened, data: data.slice(), focusedIndex: _this.focusedIndex(), value: _this.value, textField: textField, valueField: dataItemKey, optionsGuid: _this.base.guid, listRef: function (list) { return 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, onScroll:
|
|
138
|
-
|
|
139
|
-
|
|
144
|
+
return (React.createElement(List_1.default, { id: _this.base.listBoxId, show: opened, data: data.slice(), focusedIndex: _this.focusedIndex(), value: _this.value, textField: textField, valueField: dataItemKey, optionsGuid: _this.base.guid, groupField: _this.props.groupField, groupMode: 'modern', listRef: function (list) { return 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, groupHeaderItemRender: groupHeaderItemRender, noDataRender: listNoDataRender, onScroll: _this.onScroll, wrapperRef: vs.scrollerRef, scroller: _this.base.renderScrollElement() }));
|
|
145
|
+
};
|
|
146
|
+
_this.onScroll = function (event) {
|
|
147
|
+
var _a = _this.base, vs = _a.vs, list = _a.list;
|
|
148
|
+
vs.scrollHandler(event);
|
|
149
|
+
var groupField = _this.props.groupField;
|
|
150
|
+
var _b = _this.props.data, data = _b === void 0 ? [] : _b;
|
|
151
|
+
if (!groupField || !data.length) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (groupField) {
|
|
155
|
+
var itemHeight = _this.itemHeight =
|
|
156
|
+
_this.itemHeight || (vs.enabled ? vs.itemHeight : (list ? list.children[0].offsetHeight : 0));
|
|
157
|
+
var target = event.target;
|
|
158
|
+
var scrollTop = target.scrollTop - (vs.skip * itemHeight);
|
|
159
|
+
data = _this.base.getGroupedDataModernMode(data, groupField);
|
|
160
|
+
var group = data[0][groupField];
|
|
161
|
+
for (var i = 1; i < data.length; i++) {
|
|
162
|
+
if (itemHeight * i > scrollTop) {
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
if (data[i] && data[i][groupField]) {
|
|
166
|
+
group = data[i][groupField];
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (group !== _this.state.group) {
|
|
170
|
+
_this.setState({
|
|
171
|
+
group: group
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
140
175
|
};
|
|
141
176
|
_this.renderListFilter = function () {
|
|
142
177
|
var filterText = _this.props.filter !== undefined ? _this.props.filter : _this.state.text;
|
|
@@ -457,7 +492,9 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
457
492
|
* @hidden
|
|
458
493
|
*/
|
|
459
494
|
DropDownListWithoutContext.prototype.componentDidUpdate = function (prevProps, prevState) {
|
|
460
|
-
var _a
|
|
495
|
+
var _a;
|
|
496
|
+
var _b = this.props, dataItemKey = _b.dataItemKey, virtual = _b.virtual, _c = _b.groupField, groupField = _c === void 0 ? '' : _c;
|
|
497
|
+
var _d = this.props.data, data = _d === void 0 ? [] : _d;
|
|
461
498
|
var prevTotal = prevProps.virtual ? prevProps.virtual.total : 0;
|
|
462
499
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
463
500
|
var prevOpened = prevProps.opened !== undefined ? prevProps.opened : prevState.opened;
|
|
@@ -479,6 +516,9 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
479
516
|
var selectedItem_1 = this.value;
|
|
480
517
|
var prevSelectedItem = prevProps.value !== undefined ? prevProps.value : prevState.value;
|
|
481
518
|
var selectedItemIndex = data.findIndex(function (i) { return (0, utils_1.areSame)(i, selectedItem_1, dataItemKey); });
|
|
519
|
+
if (groupField !== '') {
|
|
520
|
+
selectedItemIndex = (_a = this.base.getGroupedDataModernMode(data, groupField)) === null || _a === void 0 ? void 0 : _a.indexOf(selectedItem_1);
|
|
521
|
+
}
|
|
482
522
|
var selectedItemChanged = !(0, utils_1.areSame)(prevSelectedItem, selectedItem_1, dataItemKey);
|
|
483
523
|
if (opening && virtual) {
|
|
484
524
|
this.base.scrollToVirtualItem(virtual, selectedItemIndex);
|
|
@@ -599,7 +639,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
599
639
|
var _a;
|
|
600
640
|
var _this = this;
|
|
601
641
|
var _b = this.state.windowWidth, windowWidth = _b === void 0 ? 0 : _b;
|
|
602
|
-
var _c = this.props, header = _c.header, footer = _c.footer, size = _c.size, adaptiveTitle = _c.adaptiveTitle;
|
|
642
|
+
var _c = this.props, header = _c.header, footer = _c.footer, size = _c.size, adaptiveTitle = _c.adaptiveTitle, groupField = _c.groupField, groupStickyHeaderItemRender = _c.groupStickyHeaderItemRender, list = _c.list, _d = _c.data, data = _d === void 0 ? [] : _d;
|
|
603
643
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
604
644
|
var actionSheetProps = {
|
|
605
645
|
navigatable: false,
|
|
@@ -612,6 +652,10 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
612
652
|
? 'k-adaptive-actionsheet k-actionsheet-fullscreen'
|
|
613
653
|
: 'k-adaptive-actionsheet k-actionsheet-bottom'
|
|
614
654
|
};
|
|
655
|
+
var group = this.state.group;
|
|
656
|
+
if (group === undefined && groupField !== undefined) {
|
|
657
|
+
group = (0, utils_1.getItemValue)(data[0], groupField);
|
|
658
|
+
}
|
|
615
659
|
return (React.createElement(React.Fragment, null,
|
|
616
660
|
React.createElement(kendo_react_layout_1.ActionSheet, __assign({}, actionSheetProps),
|
|
617
661
|
React.createElement(kendo_react_layout_1.ActionSheetHeader, { className: 'k-text-center' },
|
|
@@ -625,6 +669,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
625
669
|
header && React.createElement("div", { className: "k-list-header" }, header),
|
|
626
670
|
React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-list', (_a = {}, _a["k-list-".concat(sizeMap[size] || size)] = size, _a['k-virtual-list'] = this.base.vs.enabled, _a)) },
|
|
627
671
|
this.renderDefaultItem(),
|
|
672
|
+
!list && group && React.createElement(GroupStickyHeader_1.default, { group: group, groupMode: 'modern', render: groupStickyHeaderItemRender }),
|
|
628
673
|
this.renderList()),
|
|
629
674
|
footer && React.createElement("div", { className: "k-list-footer" }, footer)))));
|
|
630
675
|
};
|
|
@@ -674,11 +719,11 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
674
719
|
/**
|
|
675
720
|
* @hidden
|
|
676
721
|
*/
|
|
677
|
-
DropDownListWithoutContext.propTypes = __assign({ delay: PropTypes.number, ignoreCase: PropTypes.bool, iconClassName: PropTypes.string, svgIcon: kendo_react_common_1.svgIconPropType, defaultItem: PropTypes.any, valueRender: PropTypes.func, valueMap: PropTypes.func, validationMessage: PropTypes.string, required: PropTypes.bool, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string, ariaLabel: PropTypes.string, leftRightKeysNavigation: PropTypes.bool, title: PropTypes.string }, DropDownBase_1.default.propTypes);
|
|
722
|
+
DropDownListWithoutContext.propTypes = __assign({ delay: PropTypes.number, ignoreCase: PropTypes.bool, iconClassName: PropTypes.string, svgIcon: kendo_react_common_1.svgIconPropType, defaultItem: PropTypes.any, valueRender: PropTypes.func, valueMap: PropTypes.func, validationMessage: PropTypes.string, required: PropTypes.bool, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string, ariaLabel: PropTypes.string, leftRightKeysNavigation: PropTypes.bool, title: PropTypes.string, groupField: PropTypes.string, list: PropTypes.any }, DropDownBase_1.default.propTypes);
|
|
678
723
|
/**
|
|
679
724
|
* @hidden
|
|
680
725
|
*/
|
|
681
|
-
DropDownListWithoutContext.defaultProps = __assign(__assign({ delay: 500, tabIndex: 0, ignoreCase: true }, DropDownBase_1.default.defaultProps), { required: false, size: 'medium', rounded: 'medium', fillMode: 'solid' });
|
|
726
|
+
DropDownListWithoutContext.defaultProps = __assign(__assign({ delay: 500, tabIndex: 0, ignoreCase: true }, DropDownBase_1.default.defaultProps), { required: false, size: 'medium', rounded: 'medium', fillMode: 'solid', groupMode: 'modern' });
|
|
682
727
|
return DropDownListWithoutContext;
|
|
683
728
|
}(React.Component));
|
|
684
729
|
exports.DropDownListWithoutContext = DropDownListWithoutContext;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { DropDownList } from './DropDownList';
|
|
3
3
|
import { FilterChangeEvent, ChangeEvent, OpenEvent, CloseEvent, FocusEvent, BlurEvent, PageChangeEvent } from './../common/events';
|
|
4
4
|
import { VirtualizationSettings, DropDownsPopupSettings } 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, SVGIcon } from '@progress/kendo-react-common';
|
|
7
9
|
/**
|
|
@@ -297,4 +299,24 @@ export interface DropDownListProps extends FormComponentProps {
|
|
|
297
299
|
* Specifies the text that is rendered as title in the adaptive popup.
|
|
298
300
|
*/
|
|
299
301
|
adaptiveTitle?: string;
|
|
302
|
+
/**
|
|
303
|
+
* Sets the data item field that represents the start of a group. Applicable to objects data.
|
|
304
|
+
*/
|
|
305
|
+
groupField?: string;
|
|
306
|
+
/**
|
|
307
|
+
* Fires when a DropDownList's group header item is about to be rendered. Used to override the default appearance of the group's headers.
|
|
308
|
+
*/
|
|
309
|
+
groupHeaderItemRender?: (li: React.ReactElement<HTMLLIElement>, itemProps: ListGroupItemProps) => React.ReactNode;
|
|
310
|
+
/**
|
|
311
|
+
* Fires when a DropDownList's sticky group header item is about to be rendered. Used to override the default appearance of the sticky group header of the component.
|
|
312
|
+
*/
|
|
313
|
+
groupStickyHeaderItemRender?: (div: React.ReactElement<HTMLDivElement>, stickyHeaderProps: GroupStickyHeaderProps) => React.ReactNode;
|
|
314
|
+
/**
|
|
315
|
+
* @hidden
|
|
316
|
+
*/
|
|
317
|
+
list?: any;
|
|
318
|
+
/**
|
|
319
|
+
* @hidden
|
|
320
|
+
*/
|
|
321
|
+
groupMode?: string;
|
|
300
322
|
}
|