@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
|
@@ -73,6 +73,9 @@ export var MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
73
73
|
}, [props.data, props.groupField]);
|
|
74
74
|
var _c = React.useState(initialGroupHeader), groupHeader = _c[0], setGroupHeader = _c[1];
|
|
75
75
|
var header = React.useMemo(function () {
|
|
76
|
+
var renderer = (React.createElement("th", { className: 'k-table-th', colSpan: columns.length },
|
|
77
|
+
groupHeader,
|
|
78
|
+
" "));
|
|
76
79
|
return (React.createElement(React.Fragment, null,
|
|
77
80
|
props.header,
|
|
78
81
|
React.createElement("div", { className: "k-table-header-wrap" },
|
|
@@ -84,8 +87,7 @@ export var MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
84
87
|
React.createElement("tr", { className: 'k-table-row' }, columns.map(function (column, i) {
|
|
85
88
|
return (React.createElement("th", { className: "k-table-th", key: column.uniqueKey ? column.uniqueKey : i }, column.header || '\u00A0'));
|
|
86
89
|
})),
|
|
87
|
-
groupHeader && React.createElement("tr", { className: 'k-table-group-row' },
|
|
88
|
-
React.createElement("th", { className: 'k-table-th', colSpan: columns.length }, groupHeader)))))));
|
|
90
|
+
groupHeader && React.createElement("tr", { className: 'k-table-group-row' }, props.groupStickyHeaderItemRender ? props.groupStickyHeaderItemRender.call(undefined, renderer, {}) : renderer))))));
|
|
89
91
|
}, [props.header, columns, groupHeader]);
|
|
90
92
|
var popupWidth = React.useMemo(function () {
|
|
91
93
|
// These additional 4px are coming from the child elements side borders (fixes horizontal scrollbar)
|
|
@@ -93,7 +95,7 @@ export var MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
93
95
|
}, [columns, scrollbarWidth]);
|
|
94
96
|
var skip = props.virtual ? props.virtual.skip : 0;
|
|
95
97
|
var itemRender = React.useCallback(function (li, liProps) {
|
|
96
|
-
var children = columns.map(function (column, i) { return (React.createElement("span", { className:
|
|
98
|
+
var children = columns.map(function (column, i) { return (React.createElement("span", { className: !props.itemRender ? 'k-table-td' : undefined, style: !props.itemRender ? { width: column.width ? column.width : defaultProps.width } : undefined, key: column.uniqueKey ? column.uniqueKey : i }, column.field ? getter(column.field)(liProps.dataItem) : '')); });
|
|
97
99
|
var group = undefined;
|
|
98
100
|
var curGroup, prevGroup, groupGetter, data = props.data || [];
|
|
99
101
|
var index = liProps.index - skip;
|
|
@@ -105,7 +107,7 @@ export var MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
105
107
|
group = curGroup;
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
|
-
if (group) {
|
|
110
|
+
if (group && props.groupMode === 'classic') {
|
|
109
111
|
children.push(React.createElement("div", { key: "group", className: "k-table-td k-table-group-td" },
|
|
110
112
|
React.createElement("span", null, group)));
|
|
111
113
|
}
|
|
@@ -134,7 +136,7 @@ export var MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
134
136
|
}, []);
|
|
135
137
|
React.useEffect(function () { setScrollbarWidth(); });
|
|
136
138
|
var List = React.useCallback(function (listProps) { return React.createElement(MultiColumnList, __assign({}, listProps)); }, []);
|
|
137
|
-
return (React.createElement(ComboBox, __assign({}, other, { list: List, popupSettings: __assign(__assign({ width: popupWidth }, popupSettings), { popupClass: 'k-dropdowngrid-popup k-reset', className: popupSettings.className }), ref: comboBoxRef, header: header, itemRender: itemRender, size: props.size, rounded: props.rounded, fillMode: props.fillMode, onOpen: onOpenHandler, onClose: onCloseHandler, onFocus: onFocusHandler, onBlur: onBlurHandler, onChange: onChangeHandler, onFilterChange: onFilterChangeHandler, onPageChange: onPageChangeHandler, onGroupScroll: onGroupScroll, className: classNames('k-dropdowngrid', className), required: props.required })));
|
|
139
|
+
return (React.createElement(ComboBox, __assign({}, other, { list: List, popupSettings: __assign(__assign({ width: popupWidth }, popupSettings), { popupClass: 'k-dropdowngrid-popup k-reset', className: popupSettings.className }), ref: comboBoxRef, header: header, itemRender: itemRender, groupHeaderItemRender: props.groupHeaderItemRender, size: props.size, rounded: props.rounded, fillMode: props.fillMode, groupMode: props.groupMode, groupField: props.groupField, isMultiColumn: true, onOpen: onOpenHandler, onClose: onCloseHandler, onFocus: onFocusHandler, onBlur: onBlurHandler, onChange: onChangeHandler, onFilterChange: onFilterChangeHandler, onPageChange: onPageChangeHandler, onGroupScroll: onGroupScroll, className: classNames('k-dropdowngrid', className), required: props.required })));
|
|
138
140
|
});
|
|
139
141
|
var propTypes = __assign(__assign({}, ComboBoxWithoutContext.propTypes), { columns: PropTypes.any.isRequired });
|
|
140
142
|
var defaultProps = {
|
|
@@ -41,6 +41,8 @@ export declare class MultiSelectWithoutContext extends React.Component<MultiSele
|
|
|
41
41
|
id: PropTypes.Requireable<string>;
|
|
42
42
|
ariaLabelledBy: PropTypes.Requireable<string>;
|
|
43
43
|
ariaDescribedBy: PropTypes.Requireable<string>;
|
|
44
|
+
groupField: PropTypes.Requireable<string>;
|
|
45
|
+
list: PropTypes.Requireable<any>;
|
|
44
46
|
filterable: PropTypes.Requireable<boolean>;
|
|
45
47
|
filter: PropTypes.Requireable<string>;
|
|
46
48
|
virtual: PropTypes.Requireable<PropTypes.InferProps<{
|
|
@@ -91,6 +93,7 @@ export declare class MultiSelectWithoutContext extends React.Component<MultiSele
|
|
|
91
93
|
size: "small" | "medium" | "large" | null | undefined;
|
|
92
94
|
rounded: "small" | "medium" | "full" | "large" | null | undefined;
|
|
93
95
|
fillMode: "flat" | "outline" | "solid" | null | undefined;
|
|
96
|
+
groupMode: string | undefined;
|
|
94
97
|
popupSettings: {
|
|
95
98
|
height: string;
|
|
96
99
|
};
|
|
@@ -107,6 +110,7 @@ export declare class MultiSelectWithoutContext extends React.Component<MultiSele
|
|
|
107
110
|
private readonly _tags;
|
|
108
111
|
private _input;
|
|
109
112
|
private _skipFocusEvent;
|
|
113
|
+
private itemHeight;
|
|
110
114
|
protected scrollToFocused: boolean;
|
|
111
115
|
constructor(props: MultiSelectProps);
|
|
112
116
|
/**
|
|
@@ -175,6 +179,7 @@ export declare class MultiSelectWithoutContext extends React.Component<MultiSele
|
|
|
175
179
|
private getFocusedState;
|
|
176
180
|
private renderListContainer;
|
|
177
181
|
private renderList;
|
|
182
|
+
private onScroll;
|
|
178
183
|
private customItemSelect;
|
|
179
184
|
private handleWrapperClick;
|
|
180
185
|
private handleItemClick;
|
|
@@ -40,6 +40,7 @@ import { plusIcon } from '@progress/kendo-svg-icons';
|
|
|
40
40
|
import { FloatingLabel } from '@progress/kendo-react-labels';
|
|
41
41
|
import ListContainer from '../common/ListContainer';
|
|
42
42
|
import List from '../common/List';
|
|
43
|
+
import GroupStickyHeader from '../common/GroupStickyHeader';
|
|
43
44
|
import TagList from './TagList';
|
|
44
45
|
import SearchBar from '../common/SearchBar';
|
|
45
46
|
import DropDownBase from '../common/DropDownBase';
|
|
@@ -76,6 +77,7 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
76
77
|
_this._tags = [];
|
|
77
78
|
_this._input = null;
|
|
78
79
|
_this._skipFocusEvent = false;
|
|
80
|
+
_this.itemHeight = 0;
|
|
79
81
|
_this.scrollToFocused = false;
|
|
80
82
|
/**
|
|
81
83
|
* @hidden
|
|
@@ -250,7 +252,7 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
250
252
|
_this.renderListContainer = function () {
|
|
251
253
|
var _a, _b;
|
|
252
254
|
var base = _this.base;
|
|
253
|
-
var _c = _this.props, header = _c.header, footer = _c.footer, allowCustom = _c.allowCustom, dir = _c.dir, _d = _c.data, data = _d === void 0 ? [] : _d, size = _c.size;
|
|
255
|
+
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, groupStickyHeaderItemRender = _c.groupStickyHeaderItemRender, groupField = _c.groupField, list = _c.list;
|
|
254
256
|
var popupSettings = _this.base.getPopupSettings();
|
|
255
257
|
var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
|
|
256
258
|
var text = _this.props.filter !== undefined ? _this.props.filter : _this.state.text;
|
|
@@ -277,26 +279,60 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
277
279
|
React.createElement("div", { className: classNames('k-list-item k-custom-item', { 'k-focus': isCustom(focusedType) }), style: { fontStyle: 'italic' } },
|
|
278
280
|
text,
|
|
279
281
|
React.createElement(IconWrap, { name: 'plus', icon: plusIcon, style: { position: 'absolute', right: '0.5em' } }))));
|
|
282
|
+
var group = _this.state.group;
|
|
283
|
+
if (group === undefined && groupField !== undefined) {
|
|
284
|
+
group = getItemValue(data[0], groupField);
|
|
285
|
+
}
|
|
280
286
|
return (React.createElement(ListContainer, __assign({}, listContainerProps),
|
|
281
287
|
header && React.createElement("div", { className: "k-list-header" }, header),
|
|
282
288
|
customItem,
|
|
283
289
|
React.createElement("div", { className: classNames('k-list', (_b = {},
|
|
284
290
|
_b["k-list-".concat(sizeMap[size] || size)] = size,
|
|
285
291
|
_b['k-virtual-list'] = _this.base.vs.enabled,
|
|
286
|
-
_b)) },
|
|
292
|
+
_b)) },
|
|
293
|
+
!list && group && React.createElement(GroupStickyHeader, { group: group, groupMode: 'modern', render: groupStickyHeaderItemRender }),
|
|
294
|
+
_this.renderList()),
|
|
287
295
|
footer && React.createElement("div", { className: "k-list-footer" }, footer)));
|
|
288
296
|
};
|
|
289
297
|
_this.renderList = function () {
|
|
290
|
-
var _a = _this.props, _b = _a.data, data = _b === void 0 ? [] : _b, textField = _a.textField, listNoDataRender = _a.listNoDataRender, itemRender = _a.itemRender, dataItemKey = _a.dataItemKey, virtual = _a.virtual;
|
|
298
|
+
var _a = _this.props, _b = _a.data, data = _b === void 0 ? [] : _b, textField = _a.textField, listNoDataRender = _a.listNoDataRender, itemRender = _a.itemRender, groupHeaderItemRender = _a.groupHeaderItemRender, dataItemKey = _a.dataItemKey, virtual = _a.virtual;
|
|
291
299
|
var vs = _this.base.vs;
|
|
292
300
|
var skip = virtual ? virtual.skip : 0;
|
|
293
301
|
var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
|
|
294
302
|
var focusedIndex = _this.getFocusedState().focusedIndex;
|
|
295
303
|
var popupSettings = _this.base.getPopupSettings();
|
|
296
304
|
var translate = "translateY(".concat(vs.translate, "px)");
|
|
297
|
-
return (React.createElement(List, { id: _this.base.listBoxId, show: opened, data: data.slice(), focusedIndex: focusedIndex - skip, value: _this.value, textField: textField, valueField: dataItemKey, optionsGuid: _this.base.guid, listRef: function (list) { vs.list = _this.base.list = list; }, wrapperStyle: { maxHeight: popupSettings.height }, wrapperCssClass: "k-list-content", listStyle: vs.enabled ? { transform: translate } : undefined, key: "listKey", skip: skip, onClick: _this.handleItemClick, itemRender: itemRender, noDataRender: listNoDataRender, onMouseDown: preventDefault, onBlur: _this.handleBlur, onScroll:
|
|
298
|
-
|
|
299
|
-
|
|
305
|
+
return (React.createElement(List, { id: _this.base.listBoxId, show: opened, data: data.slice(), focusedIndex: focusedIndex - skip, value: _this.value, textField: textField, valueField: dataItemKey, optionsGuid: _this.base.guid, groupField: _this.props.groupField, groupMode: 'modern', 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, groupHeaderItemRender: groupHeaderItemRender, noDataRender: listNoDataRender, onMouseDown: preventDefault, onBlur: _this.handleBlur, onScroll: _this.onScroll, wrapperRef: vs.scrollerRef, scroller: _this.base.renderScrollElement() }));
|
|
306
|
+
};
|
|
307
|
+
_this.onScroll = function (event) {
|
|
308
|
+
var _a = _this.base, vs = _a.vs, list = _a.list;
|
|
309
|
+
vs.scrollHandler(event);
|
|
310
|
+
var groupField = _this.props.groupField;
|
|
311
|
+
var _b = _this.props.data, data = _b === void 0 ? [] : _b;
|
|
312
|
+
if (!groupField || !data.length) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
if (groupField) {
|
|
316
|
+
var itemHeight = _this.itemHeight =
|
|
317
|
+
_this.itemHeight || (vs.enabled ? vs.itemHeight : (list ? list.children[0].offsetHeight : 0));
|
|
318
|
+
var target = event.target;
|
|
319
|
+
var scrollTop = target.scrollTop - (vs.skip * itemHeight);
|
|
320
|
+
data = _this.base.getGroupedDataModernMode(data, groupField);
|
|
321
|
+
var group = data[0][groupField];
|
|
322
|
+
for (var i = 1; i < data.length; i++) {
|
|
323
|
+
if (itemHeight * i > scrollTop) {
|
|
324
|
+
break;
|
|
325
|
+
}
|
|
326
|
+
if (data[i] && data[i][groupField]) {
|
|
327
|
+
group = data[i][groupField];
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if (group !== _this.state.group) {
|
|
331
|
+
_this.setState({
|
|
332
|
+
group: group
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
}
|
|
300
336
|
};
|
|
301
337
|
_this.customItemSelect = function (event) {
|
|
302
338
|
var _a;
|
|
@@ -478,7 +514,9 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
478
514
|
* @hidden
|
|
479
515
|
*/
|
|
480
516
|
MultiSelectWithoutContext.prototype.componentDidUpdate = function (prevProps, prevState) {
|
|
481
|
-
var
|
|
517
|
+
var _a;
|
|
518
|
+
var _b = this.props, virtual = _b.virtual, _c = _b.groupField, groupField = _c === void 0 ? '' : _c;
|
|
519
|
+
var _d = this.props.data, data = _d === void 0 ? [] : _d;
|
|
482
520
|
var skip = virtual ? virtual.skip : 0;
|
|
483
521
|
var prevTotal = prevProps.virtual ? prevProps.virtual.total : 0;
|
|
484
522
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
@@ -494,7 +532,10 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
494
532
|
this.base.vs.reset();
|
|
495
533
|
}
|
|
496
534
|
else {
|
|
497
|
-
var
|
|
535
|
+
var _e = this.getFocusedState(), focusedItem = _e.focusedItem, focusedIndex = _e.focusedIndex;
|
|
536
|
+
if (groupField !== '') {
|
|
537
|
+
focusedIndex = (_a = this.base.getGroupedDataModernMode(data, groupField)) === null || _a === void 0 ? void 0 : _a.indexOf(focusedItem);
|
|
538
|
+
}
|
|
498
539
|
if (opening && virtual) {
|
|
499
540
|
this.base.scrollToVirtualItem(virtual, focusedIndex - skip);
|
|
500
541
|
}
|
|
@@ -743,11 +784,11 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
743
784
|
MultiSelectWithoutContext.propTypes = __assign(__assign({}, DropDownBase.propTypes), { autoClose: PropTypes.bool, value: PropTypes.arrayOf(PropTypes.any), defaultValue: PropTypes.arrayOf(PropTypes.any), dataItemKey: PropTypes.string, placeholder: PropTypes.string, tags: PropTypes.arrayOf(PropTypes.shape({
|
|
744
785
|
text: PropTypes.string,
|
|
745
786
|
data: PropTypes.arrayOf(PropTypes.any)
|
|
746
|
-
})), tagRender: PropTypes.func, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string });
|
|
787
|
+
})), tagRender: PropTypes.func, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string, groupField: PropTypes.string, list: PropTypes.any });
|
|
747
788
|
/**
|
|
748
789
|
* @hidden
|
|
749
790
|
*/
|
|
750
|
-
MultiSelectWithoutContext.defaultProps = __assign(__assign({}, DropDownBase.defaultProps), { autoClose: true, required: false, size: 'medium', rounded: 'medium', fillMode: 'solid' });
|
|
791
|
+
MultiSelectWithoutContext.defaultProps = __assign(__assign({}, DropDownBase.defaultProps), { autoClose: true, required: false, size: 'medium', rounded: 'medium', fillMode: 'solid', groupMode: 'modern' });
|
|
751
792
|
return MultiSelectWithoutContext;
|
|
752
793
|
}(React.Component));
|
|
753
794
|
export { MultiSelectWithoutContext };
|
|
@@ -3,6 +3,8 @@ import { MultiSelect } from './MultiSelect';
|
|
|
3
3
|
import { FormComponentProps } from '@progress/kendo-react-common';
|
|
4
4
|
import { FilterChangeEvent, ChangeEvent, OpenEvent, CloseEvent, FocusEvent, BlurEvent, PageChangeEvent } from './../common/events';
|
|
5
5
|
import { VirtualizationSettings, DropDownsPopupSettings } from '../common/settings';
|
|
6
|
+
import { ListGroupItemProps } from '../common/ListGroupItem';
|
|
7
|
+
import { GroupStickyHeaderProps } from '../common/GroupStickyHeader';
|
|
6
8
|
import { ListItemProps } from '../common/ListItem';
|
|
7
9
|
import { TagData } from './TagList';
|
|
8
10
|
/**
|
|
@@ -264,4 +266,24 @@ export interface MultiSelectProps extends FormComponentProps {
|
|
|
264
266
|
* @default `solid`
|
|
265
267
|
*/
|
|
266
268
|
fillMode?: null | 'solid' | 'flat' | 'outline';
|
|
269
|
+
/**
|
|
270
|
+
* Sets the data item field that represents the start of a group. Applicable to objects data.
|
|
271
|
+
*/
|
|
272
|
+
groupField?: string;
|
|
273
|
+
/**
|
|
274
|
+
* Fires when a DropDownList's group header item is about to be rendered. Used to override the default appearance of the group's headers.
|
|
275
|
+
*/
|
|
276
|
+
groupHeaderItemRender?: (li: React.ReactElement<HTMLLIElement>, itemProps: ListGroupItemProps) => React.ReactNode;
|
|
277
|
+
/**
|
|
278
|
+
* 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.
|
|
279
|
+
*/
|
|
280
|
+
groupStickyHeaderItemRender?: (div: React.ReactElement<HTMLDivElement>, stickyHeaderProps: GroupStickyHeaderProps) => React.ReactNode;
|
|
281
|
+
/**
|
|
282
|
+
* @hidden
|
|
283
|
+
*/
|
|
284
|
+
list?: any;
|
|
285
|
+
/**
|
|
286
|
+
* @hidden
|
|
287
|
+
*/
|
|
288
|
+
groupMode?: string;
|
|
267
289
|
}
|
|
@@ -160,4 +160,5 @@ export default class DropDownBase {
|
|
|
160
160
|
scrollToVirtualItem: (virtual: VirtualizationSettings, selectedItemIndex: number) => void;
|
|
161
161
|
renderScrollElement: () => false | JSX.Element;
|
|
162
162
|
getPopupSettings(): DropDownsPopupSettings;
|
|
163
|
+
getGroupedDataModernMode(data: any[], groupField: string): any[];
|
|
163
164
|
}
|
|
@@ -209,6 +209,19 @@ var DropDownBase = /** @class */ (function () {
|
|
|
209
209
|
return Object
|
|
210
210
|
.assign({}, DropDownBase.defaultProps.popupSettings, this.component.props.popupSettings);
|
|
211
211
|
};
|
|
212
|
+
DropDownBase.prototype.getGroupedDataModernMode = function (data, groupField) {
|
|
213
|
+
var newData = [];
|
|
214
|
+
data.forEach(function (el, index) {
|
|
215
|
+
if (data[index - 1] && el[groupField] !== data[index - 1][groupField]) {
|
|
216
|
+
newData.push({ position: el[groupField] });
|
|
217
|
+
newData.push(data[index]);
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
newData.push(data[index]);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
return newData;
|
|
224
|
+
};
|
|
212
225
|
DropDownBase.basicPropTypes = {
|
|
213
226
|
opened: PropTypes.bool,
|
|
214
227
|
disabled: PropTypes.bool,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the props of the GroupStickyHeader component.
|
|
4
|
+
*/
|
|
5
|
+
export interface GroupStickyHeaderProps {
|
|
6
|
+
/**
|
|
7
|
+
* The group that will be rendered.
|
|
8
|
+
*/
|
|
9
|
+
group?: string;
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
groupMode?: string;
|
|
14
|
+
/**
|
|
15
|
+
* 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.
|
|
16
|
+
*/
|
|
17
|
+
render?: (div: React.ReactElement<HTMLDivElement>, itemProps: GroupStickyHeaderProps) => React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
export default class GroupStickyHeader extends React.Component<GroupStickyHeaderProps, {}> {
|
|
23
|
+
render(): string | number | boolean | React.ReactFragment | JSX.Element | null | undefined;
|
|
24
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 GroupStickyHeader = /** @class */ (function (_super) {
|
|
21
|
+
__extends(GroupStickyHeader, _super);
|
|
22
|
+
function GroupStickyHeader() {
|
|
23
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
+
}
|
|
25
|
+
GroupStickyHeader.prototype.render = function () {
|
|
26
|
+
var _a = this.props, group = _a.group, groupMode = _a.groupMode, renderer = _a.render;
|
|
27
|
+
var item = (React.createElement("div", { className: "k-list-group-sticky-header" }, groupMode === 'classic'
|
|
28
|
+
? group
|
|
29
|
+
: React.createElement("div", { className: "k-list-header-text" }, group)));
|
|
30
|
+
return renderer !== undefined ? renderer.call(undefined, item, this.props) : item;
|
|
31
|
+
};
|
|
32
|
+
return GroupStickyHeader;
|
|
33
|
+
}(React.Component));
|
|
34
|
+
export default GroupStickyHeader;
|
package/dist/es/common/List.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ListItemProps } from './ListItem';
|
|
3
|
+
import { ListGroupItemProps } from './ListGroupItem';
|
|
3
4
|
import { LocalizationService } from '@progress/kendo-react-intl';
|
|
4
5
|
/**
|
|
5
6
|
* @hidden
|
|
@@ -13,6 +14,8 @@ export interface ListProps {
|
|
|
13
14
|
textField?: string;
|
|
14
15
|
valueField?: string;
|
|
15
16
|
groupField?: string;
|
|
17
|
+
groupMode?: string;
|
|
18
|
+
isMultiColumn?: boolean;
|
|
16
19
|
optionsGuid?: string;
|
|
17
20
|
listRef?: React.Ref<HTMLUListElement>;
|
|
18
21
|
wrapperRef?: React.Ref<HTMLDivElement>;
|
|
@@ -25,6 +28,7 @@ export interface ListProps {
|
|
|
25
28
|
highlightSelected?: boolean;
|
|
26
29
|
onClick: (index: number, event: React.MouseEvent<HTMLLIElement>) => void;
|
|
27
30
|
itemRender?: (li: React.ReactElement<HTMLLIElement>, itemProps: ListItemProps) => React.ReactNode;
|
|
31
|
+
groupHeaderItemRender?: (li: React.ReactElement<HTMLLIElement>, groupItemProps: ListGroupItemProps) => React.ReactNode;
|
|
28
32
|
noDataRender?: (element: React.ReactElement<HTMLDivElement>) => React.ReactNode;
|
|
29
33
|
onMouseDown?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
30
34
|
onBlur?: (event: React.FocusEvent<HTMLDivElement>) => void;
|
|
@@ -35,7 +39,7 @@ export interface ListProps {
|
|
|
35
39
|
* @hidden
|
|
36
40
|
*/
|
|
37
41
|
export default class List extends React.Component<ListProps> {
|
|
38
|
-
renderItems(): JSX.Element[];
|
|
42
|
+
renderItems(): (false | JSX.Element)[][];
|
|
39
43
|
renderNoValueElement(localizationService: LocalizationService): string | number | boolean | React.ReactFragment | JSX.Element | null | undefined;
|
|
40
44
|
render(): string | number | boolean | React.ReactFragment | JSX.Element | null | undefined;
|
|
41
45
|
}
|
package/dist/es/common/List.js
CHANGED
|
@@ -15,6 +15,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
15
15
|
})();
|
|
16
16
|
import * as React from 'react';
|
|
17
17
|
import ListItem from './ListItem';
|
|
18
|
+
import ListGroupItem from './ListGroupItem';
|
|
18
19
|
import { areSame, getItemValue } from './utils';
|
|
19
20
|
import { registerForLocalization, provideLocalizationService } from '@progress/kendo-react-intl';
|
|
20
21
|
import { messages, nodata } from '../messages';
|
|
@@ -28,10 +29,12 @@ var List = /** @class */ (function (_super) {
|
|
|
28
29
|
}
|
|
29
30
|
List.prototype.renderItems = function () {
|
|
30
31
|
var _this = this;
|
|
31
|
-
var _a = this.props, textField = _a.textField, valueField = _a.valueField, groupField = _a.groupField, optionsGuid = _a.optionsGuid, _b = _a.skip, skip = _b === void 0 ? 0 : _b, virtual = _a.virtual, focusedIndex = _a.focusedIndex, _c = _a.highlightSelected, highlightSelected = _c === void 0 ? true : _c, value = _a.value, data = _a.data, itemRender = _a.itemRender;
|
|
32
|
+
var _a = this.props, textField = _a.textField, valueField = _a.valueField, groupField = _a.groupField, groupMode = _a.groupMode, isMultiColumn = _a.isMultiColumn, optionsGuid = _a.optionsGuid, _b = _a.skip, skip = _b === void 0 ? 0 : _b, virtual = _a.virtual, focusedIndex = _a.focusedIndex, _c = _a.highlightSelected, highlightSelected = _c === void 0 ? true : _c, value = _a.value, data = _a.data, itemRender = _a.itemRender, groupHeaderItemRender = _a.groupHeaderItemRender;
|
|
32
33
|
var isArray = Array.isArray(value);
|
|
34
|
+
var groupCounter = 0;
|
|
33
35
|
return data.map(function (item, index) {
|
|
34
36
|
var realIndex = skip + index;
|
|
37
|
+
var idIndex = skip + index + groupCounter;
|
|
35
38
|
var selected = highlightSelected &&
|
|
36
39
|
((!isArray && areSame(item, value, valueField)) ||
|
|
37
40
|
(isArray && value.findIndex(function (i) { return areSame(i, item, valueField); }) !== -1));
|
|
@@ -44,7 +47,11 @@ var List = /** @class */ (function (_super) {
|
|
|
44
47
|
group = current;
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
|
-
|
|
50
|
+
group !== undefined && groupMode === 'modern' ? groupCounter += 1 : '';
|
|
51
|
+
return [
|
|
52
|
+
group !== undefined && groupMode === 'modern' && React.createElement(ListGroupItem, { id: "option-".concat(optionsGuid, "-").concat(idIndex), virtual: virtual, key: realIndex + '-group-item', group: group, isMultiColumn: isMultiColumn, render: groupHeaderItemRender }),
|
|
53
|
+
React.createElement(ListItem, { id: "option-".concat(optionsGuid, "-").concat(group !== undefined && groupMode === 'modern' ? idIndex + 1 : idIndex), virtual: virtual, dataItem: item, groupMode: groupMode, selected: selected, focused: focusedIndex === index, index: realIndex, key: realIndex, onClick: _this.props.onClick, textField: textField, group: group, render: itemRender })
|
|
54
|
+
];
|
|
48
55
|
});
|
|
49
56
|
};
|
|
50
57
|
List.prototype.renderNoValueElement = function (localizationService) {
|
|
@@ -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:
|
|
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;
|