@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
|
@@ -76,6 +76,9 @@ exports.MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
76
76
|
}, [props.data, props.groupField]);
|
|
77
77
|
var _c = React.useState(initialGroupHeader), groupHeader = _c[0], setGroupHeader = _c[1];
|
|
78
78
|
var header = React.useMemo(function () {
|
|
79
|
+
var renderer = (React.createElement("th", { className: 'k-table-th', colSpan: columns.length },
|
|
80
|
+
groupHeader,
|
|
81
|
+
" "));
|
|
79
82
|
return (React.createElement(React.Fragment, null,
|
|
80
83
|
props.header,
|
|
81
84
|
React.createElement("div", { className: "k-table-header-wrap" },
|
|
@@ -87,8 +90,7 @@ exports.MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
87
90
|
React.createElement("tr", { className: 'k-table-row' }, columns.map(function (column, i) {
|
|
88
91
|
return (React.createElement("th", { className: "k-table-th", key: column.uniqueKey ? column.uniqueKey : i }, column.header || '\u00A0'));
|
|
89
92
|
})),
|
|
90
|
-
groupHeader && React.createElement("tr", { className: 'k-table-group-row' },
|
|
91
|
-
React.createElement("th", { className: 'k-table-th', colSpan: columns.length }, groupHeader)))))));
|
|
93
|
+
groupHeader && React.createElement("tr", { className: 'k-table-group-row' }, props.groupStickyHeaderItemRender ? props.groupStickyHeaderItemRender.call(undefined, renderer, {}) : renderer))))));
|
|
92
94
|
}, [props.header, columns, groupHeader]);
|
|
93
95
|
var popupWidth = React.useMemo(function () {
|
|
94
96
|
// These additional 4px are coming from the child elements side borders (fixes horizontal scrollbar)
|
|
@@ -96,7 +98,7 @@ exports.MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
96
98
|
}, [columns, scrollbarWidth]);
|
|
97
99
|
var skip = props.virtual ? props.virtual.skip : 0;
|
|
98
100
|
var itemRender = React.useCallback(function (li, liProps) {
|
|
99
|
-
var children = columns.map(function (column, i) { return (React.createElement("span", { className:
|
|
101
|
+
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 ? (0, kendo_react_common_1.getter)(column.field)(liProps.dataItem) : '')); });
|
|
100
102
|
var group = undefined;
|
|
101
103
|
var curGroup, prevGroup, groupGetter, data = props.data || [];
|
|
102
104
|
var index = liProps.index - skip;
|
|
@@ -108,7 +110,7 @@ exports.MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
108
110
|
group = curGroup;
|
|
109
111
|
}
|
|
110
112
|
}
|
|
111
|
-
if (group) {
|
|
113
|
+
if (group && props.groupMode === 'classic') {
|
|
112
114
|
children.push(React.createElement("div", { key: "group", className: "k-table-td k-table-group-td" },
|
|
113
115
|
React.createElement("span", null, group)));
|
|
114
116
|
}
|
|
@@ -137,7 +139,7 @@ exports.MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
137
139
|
}, []);
|
|
138
140
|
React.useEffect(function () { (0, kendo_react_common_1.setScrollbarWidth)(); });
|
|
139
141
|
var List = React.useCallback(function (listProps) { return React.createElement(MultiColumnList_1.MultiColumnList, __assign({}, listProps)); }, []);
|
|
140
|
-
return (React.createElement(ComboBox_1.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: (0, kendo_react_common_1.classNames)('k-dropdowngrid', className), required: props.required })));
|
|
142
|
+
return (React.createElement(ComboBox_1.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: (0, kendo_react_common_1.classNames)('k-dropdowngrid', className), required: props.required })));
|
|
141
143
|
});
|
|
142
144
|
var propTypes = __assign(__assign({}, ComboBox_1.ComboBoxWithoutContext.propTypes), { columns: PropTypes.any.isRequired });
|
|
143
145
|
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;
|
|
@@ -43,6 +43,7 @@ var kendo_svg_icons_1 = require("@progress/kendo-svg-icons");
|
|
|
43
43
|
var kendo_react_labels_1 = require("@progress/kendo-react-labels");
|
|
44
44
|
var ListContainer_1 = require("../common/ListContainer");
|
|
45
45
|
var List_1 = require("../common/List");
|
|
46
|
+
var GroupStickyHeader_1 = require("../common/GroupStickyHeader");
|
|
46
47
|
var TagList_1 = require("./TagList");
|
|
47
48
|
var SearchBar_1 = require("../common/SearchBar");
|
|
48
49
|
var DropDownBase_1 = require("../common/DropDownBase");
|
|
@@ -79,6 +80,7 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
79
80
|
_this._tags = [];
|
|
80
81
|
_this._input = null;
|
|
81
82
|
_this._skipFocusEvent = false;
|
|
83
|
+
_this.itemHeight = 0;
|
|
82
84
|
_this.scrollToFocused = false;
|
|
83
85
|
/**
|
|
84
86
|
* @hidden
|
|
@@ -253,7 +255,7 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
253
255
|
_this.renderListContainer = function () {
|
|
254
256
|
var _a, _b;
|
|
255
257
|
var base = _this.base;
|
|
256
|
-
var _c = _this.props, header = _c.header, footer = _c.footer, allowCustom = _c.allowCustom, dir = _c.dir, _d = _c.data, data = _d === void 0 ? [] : _d, size = _c.size;
|
|
258
|
+
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;
|
|
257
259
|
var popupSettings = _this.base.getPopupSettings();
|
|
258
260
|
var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
|
|
259
261
|
var text = _this.props.filter !== undefined ? _this.props.filter : _this.state.text;
|
|
@@ -280,26 +282,60 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
280
282
|
React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-list-item k-custom-item', { 'k-focus': isCustom(focusedType) }), style: { fontStyle: 'italic' } },
|
|
281
283
|
text,
|
|
282
284
|
React.createElement(kendo_react_common_1.IconWrap, { name: 'plus', icon: kendo_svg_icons_1.plusIcon, style: { position: 'absolute', right: '0.5em' } }))));
|
|
285
|
+
var group = _this.state.group;
|
|
286
|
+
if (group === undefined && groupField !== undefined) {
|
|
287
|
+
group = (0, utils_1.getItemValue)(data[0], groupField);
|
|
288
|
+
}
|
|
283
289
|
return (React.createElement(ListContainer_1.default, __assign({}, listContainerProps),
|
|
284
290
|
header && React.createElement("div", { className: "k-list-header" }, header),
|
|
285
291
|
customItem,
|
|
286
292
|
React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-list', (_b = {},
|
|
287
293
|
_b["k-list-".concat(sizeMap[size] || size)] = size,
|
|
288
294
|
_b['k-virtual-list'] = _this.base.vs.enabled,
|
|
289
|
-
_b)) },
|
|
295
|
+
_b)) },
|
|
296
|
+
!list && group && React.createElement(GroupStickyHeader_1.default, { group: group, groupMode: 'modern', render: groupStickyHeaderItemRender }),
|
|
297
|
+
_this.renderList()),
|
|
290
298
|
footer && React.createElement("div", { className: "k-list-footer" }, footer)));
|
|
291
299
|
};
|
|
292
300
|
_this.renderList = function () {
|
|
293
|
-
var _a = _this.props, _b = _a.data, data = _b === void 0 ? [] : _b, textField = _a.textField, listNoDataRender = _a.listNoDataRender, itemRender = _a.itemRender, dataItemKey = _a.dataItemKey, virtual = _a.virtual;
|
|
301
|
+
var _a = _this.props, _b = _a.data, data = _b === void 0 ? [] : _b, textField = _a.textField, listNoDataRender = _a.listNoDataRender, itemRender = _a.itemRender, groupHeaderItemRender = _a.groupHeaderItemRender, dataItemKey = _a.dataItemKey, virtual = _a.virtual;
|
|
294
302
|
var vs = _this.base.vs;
|
|
295
303
|
var skip = virtual ? virtual.skip : 0;
|
|
296
304
|
var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
|
|
297
305
|
var focusedIndex = _this.getFocusedState().focusedIndex;
|
|
298
306
|
var popupSettings = _this.base.getPopupSettings();
|
|
299
307
|
var translate = "translateY(".concat(vs.translate, "px)");
|
|
300
|
-
return (React.createElement(List_1.default, { id: _this.base.listBoxId, show: opened, data: data.slice(), focusedIndex: focusedIndex - skip, value: _this.value, textField: textField, valueField: dataItemKey, optionsGuid: _this.base.guid, listRef: function (list) { vs.list = _this.base.list = list; }, wrapperStyle: { maxHeight: popupSettings.height }, wrapperCssClass: "k-list-content", listStyle: vs.enabled ? { transform: translate } : undefined, key: "listKey", skip: skip, onClick: _this.handleItemClick, itemRender: itemRender, noDataRender: listNoDataRender, onMouseDown: preventDefault, onBlur: _this.handleBlur, onScroll:
|
|
301
|
-
|
|
302
|
-
|
|
308
|
+
return (React.createElement(List_1.default, { id: _this.base.listBoxId, show: opened, data: data.slice(), focusedIndex: focusedIndex - skip, value: _this.value, textField: textField, valueField: dataItemKey, optionsGuid: _this.base.guid, 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() }));
|
|
309
|
+
};
|
|
310
|
+
_this.onScroll = function (event) {
|
|
311
|
+
var _a = _this.base, vs = _a.vs, list = _a.list;
|
|
312
|
+
vs.scrollHandler(event);
|
|
313
|
+
var groupField = _this.props.groupField;
|
|
314
|
+
var _b = _this.props.data, data = _b === void 0 ? [] : _b;
|
|
315
|
+
if (!groupField || !data.length) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
if (groupField) {
|
|
319
|
+
var itemHeight = _this.itemHeight =
|
|
320
|
+
_this.itemHeight || (vs.enabled ? vs.itemHeight : (list ? list.children[0].offsetHeight : 0));
|
|
321
|
+
var target = event.target;
|
|
322
|
+
var scrollTop = target.scrollTop - (vs.skip * itemHeight);
|
|
323
|
+
data = _this.base.getGroupedDataModernMode(data, groupField);
|
|
324
|
+
var group = data[0][groupField];
|
|
325
|
+
for (var i = 1; i < data.length; i++) {
|
|
326
|
+
if (itemHeight * i > scrollTop) {
|
|
327
|
+
break;
|
|
328
|
+
}
|
|
329
|
+
if (data[i] && data[i][groupField]) {
|
|
330
|
+
group = data[i][groupField];
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
if (group !== _this.state.group) {
|
|
334
|
+
_this.setState({
|
|
335
|
+
group: group
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
}
|
|
303
339
|
};
|
|
304
340
|
_this.customItemSelect = function (event) {
|
|
305
341
|
var _a;
|
|
@@ -481,7 +517,9 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
481
517
|
* @hidden
|
|
482
518
|
*/
|
|
483
519
|
MultiSelectWithoutContext.prototype.componentDidUpdate = function (prevProps, prevState) {
|
|
484
|
-
var
|
|
520
|
+
var _a;
|
|
521
|
+
var _b = this.props, virtual = _b.virtual, _c = _b.groupField, groupField = _c === void 0 ? '' : _c;
|
|
522
|
+
var _d = this.props.data, data = _d === void 0 ? [] : _d;
|
|
485
523
|
var skip = virtual ? virtual.skip : 0;
|
|
486
524
|
var prevTotal = prevProps.virtual ? prevProps.virtual.total : 0;
|
|
487
525
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
@@ -497,7 +535,10 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
497
535
|
this.base.vs.reset();
|
|
498
536
|
}
|
|
499
537
|
else {
|
|
500
|
-
var
|
|
538
|
+
var _e = this.getFocusedState(), focusedItem = _e.focusedItem, focusedIndex = _e.focusedIndex;
|
|
539
|
+
if (groupField !== '') {
|
|
540
|
+
focusedIndex = (_a = this.base.getGroupedDataModernMode(data, groupField)) === null || _a === void 0 ? void 0 : _a.indexOf(focusedItem);
|
|
541
|
+
}
|
|
501
542
|
if (opening && virtual) {
|
|
502
543
|
this.base.scrollToVirtualItem(virtual, focusedIndex - skip);
|
|
503
544
|
}
|
|
@@ -746,11 +787,11 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
746
787
|
MultiSelectWithoutContext.propTypes = __assign(__assign({}, DropDownBase_1.default.propTypes), { autoClose: PropTypes.bool, value: PropTypes.arrayOf(PropTypes.any), defaultValue: PropTypes.arrayOf(PropTypes.any), dataItemKey: PropTypes.string, placeholder: PropTypes.string, tags: PropTypes.arrayOf(PropTypes.shape({
|
|
747
788
|
text: PropTypes.string,
|
|
748
789
|
data: PropTypes.arrayOf(PropTypes.any)
|
|
749
|
-
})), tagRender: PropTypes.func, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string });
|
|
790
|
+
})), tagRender: PropTypes.func, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string, groupField: PropTypes.string, list: PropTypes.any });
|
|
750
791
|
/**
|
|
751
792
|
* @hidden
|
|
752
793
|
*/
|
|
753
|
-
MultiSelectWithoutContext.defaultProps = __assign(__assign({}, DropDownBase_1.default.defaultProps), { autoClose: true, required: false, size: 'medium', rounded: 'medium', fillMode: 'solid' });
|
|
794
|
+
MultiSelectWithoutContext.defaultProps = __assign(__assign({}, DropDownBase_1.default.defaultProps), { autoClose: true, required: false, size: 'medium', rounded: 'medium', fillMode: 'solid', groupMode: 'modern' });
|
|
754
795
|
return MultiSelectWithoutContext;
|
|
755
796
|
}(React.Component));
|
|
756
797
|
exports.MultiSelectWithoutContext = 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
|
}
|
|
@@ -211,6 +211,19 @@ var DropDownBase = /** @class */ (function () {
|
|
|
211
211
|
return Object
|
|
212
212
|
.assign({}, DropDownBase.defaultProps.popupSettings, this.component.props.popupSettings);
|
|
213
213
|
};
|
|
214
|
+
DropDownBase.prototype.getGroupedDataModernMode = function (data, groupField) {
|
|
215
|
+
var newData = [];
|
|
216
|
+
data.forEach(function (el, index) {
|
|
217
|
+
if (data[index - 1] && el[groupField] !== data[index - 1][groupField]) {
|
|
218
|
+
newData.push({ position: el[groupField] });
|
|
219
|
+
newData.push(data[index]);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
newData.push(data[index]);
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
return newData;
|
|
226
|
+
};
|
|
214
227
|
DropDownBase.basicPropTypes = {
|
|
215
228
|
opened: PropTypes.bool,
|
|
216
229
|
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,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
var React = require("react");
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
var GroupStickyHeader = /** @class */ (function (_super) {
|
|
23
|
+
__extends(GroupStickyHeader, _super);
|
|
24
|
+
function GroupStickyHeader() {
|
|
25
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
26
|
+
}
|
|
27
|
+
GroupStickyHeader.prototype.render = function () {
|
|
28
|
+
var _a = this.props, group = _a.group, groupMode = _a.groupMode, renderer = _a.render;
|
|
29
|
+
var item = (React.createElement("div", { className: "k-list-group-sticky-header" }, groupMode === 'classic'
|
|
30
|
+
? group
|
|
31
|
+
: React.createElement("div", { className: "k-list-header-text" }, group)));
|
|
32
|
+
return renderer !== undefined ? renderer.call(undefined, item, this.props) : item;
|
|
33
|
+
};
|
|
34
|
+
return GroupStickyHeader;
|
|
35
|
+
}(React.Component));
|
|
36
|
+
exports.default = GroupStickyHeader;
|
|
@@ -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/npm/common/List.js
CHANGED
|
@@ -17,6 +17,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
var React = require("react");
|
|
19
19
|
var ListItem_1 = require("./ListItem");
|
|
20
|
+
var ListGroupItem_1 = require("./ListGroupItem");
|
|
20
21
|
var utils_1 = require("./utils");
|
|
21
22
|
var kendo_react_intl_1 = require("@progress/kendo-react-intl");
|
|
22
23
|
var messages_1 = require("../messages");
|
|
@@ -30,10 +31,12 @@ var List = /** @class */ (function (_super) {
|
|
|
30
31
|
}
|
|
31
32
|
List.prototype.renderItems = function () {
|
|
32
33
|
var _this = this;
|
|
33
|
-
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;
|
|
34
|
+
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;
|
|
34
35
|
var isArray = Array.isArray(value);
|
|
36
|
+
var groupCounter = 0;
|
|
35
37
|
return data.map(function (item, index) {
|
|
36
38
|
var realIndex = skip + index;
|
|
39
|
+
var idIndex = skip + index + groupCounter;
|
|
37
40
|
var selected = highlightSelected &&
|
|
38
41
|
((!isArray && (0, utils_1.areSame)(item, value, valueField)) ||
|
|
39
42
|
(isArray && value.findIndex(function (i) { return (0, utils_1.areSame)(i, item, valueField); }) !== -1));
|
|
@@ -46,7 +49,11 @@ var List = /** @class */ (function (_super) {
|
|
|
46
49
|
group = current;
|
|
47
50
|
}
|
|
48
51
|
}
|
|
49
|
-
|
|
52
|
+
group !== undefined && groupMode === 'modern' ? groupCounter += 1 : '';
|
|
53
|
+
return [
|
|
54
|
+
group !== undefined && groupMode === 'modern' && React.createElement(ListGroupItem_1.default, { id: "option-".concat(optionsGuid, "-").concat(idIndex), virtual: virtual, key: realIndex + '-group-item', group: group, isMultiColumn: isMultiColumn, render: groupHeaderItemRender }),
|
|
55
|
+
React.createElement(ListItem_1.default, { 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 })
|
|
56
|
+
];
|
|
50
57
|
});
|
|
51
58
|
};
|
|
52
59
|
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,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
var React = require("react");
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
var ListGroupItem = /** @class */ (function (_super) {
|
|
23
|
+
__extends(ListGroupItem, _super);
|
|
24
|
+
function ListGroupItem() {
|
|
25
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
26
|
+
}
|
|
27
|
+
ListGroupItem.prototype.render = function () {
|
|
28
|
+
var _a = this.props, group = _a.group, virtual = _a.virtual, renderer = _a.render, _b = _a.isMultiColumn, isMultiColumn = _b === void 0 ? false : _b;
|
|
29
|
+
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' } },
|
|
30
|
+
React.createElement("span", { className: !renderer ? isMultiColumn ? 'k-table-th' : 'k-list-item-text' : undefined }, group)));
|
|
31
|
+
return renderer !== undefined ? renderer.call(undefined, item, this.props) : item;
|
|
32
|
+
};
|
|
33
|
+
return ListGroupItem;
|
|
34
|
+
}(React.Component));
|
|
35
|
+
exports.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
|
*/
|
|
@@ -30,14 +30,14 @@ var ListItem = /** @class */ (function (_super) {
|
|
|
30
30
|
return _this;
|
|
31
31
|
}
|
|
32
32
|
ListItem.prototype.render = function () {
|
|
33
|
-
var _a = this.props, selected = _a.selected, group = _a.group, dataItem = _a.dataItem, virtual = _a.virtual, renderer = _a.render;
|
|
33
|
+
var _a = this.props, selected = _a.selected, group = _a.group, dataItem = _a.dataItem, virtual = _a.virtual, groupMode = _a.groupMode, renderer = _a.render;
|
|
34
34
|
var item = (React.createElement("li", { id: this.props.id, role: "option", "aria-selected": selected, className: (0, kendo_react_common_1.classNames)('k-list-item', {
|
|
35
35
|
'k-selected': selected,
|
|
36
36
|
'k-focus': this.props.focused,
|
|
37
|
-
'k-first': Boolean(group)
|
|
37
|
+
'k-first': Boolean(group) && groupMode === 'classic'
|
|
38
38
|
}), onClick: this.handleClick, style: { position: virtual ? 'relative' : 'unset' } },
|
|
39
39
|
React.createElement("span", { className: 'k-list-item-text' }, (0, utils_1.getItemValue)(dataItem, this.props.textField).toString()),
|
|
40
|
-
group !== undefined ? React.createElement("div", { className: "k-list-item-group-label" }, group) : null));
|
|
40
|
+
group !== undefined && groupMode === 'classic' ? React.createElement("div", { className: "k-list-item-group-label" }, group) : null));
|
|
41
41
|
return renderer !== undefined ? renderer.call(undefined, item, this.props) : item;
|
|
42
42
|
};
|
|
43
43
|
return ListItem;
|
|
@@ -8,7 +8,7 @@ exports.packageMetadata = {
|
|
|
8
8
|
name: '@progress/kendo-react-dropdowns',
|
|
9
9
|
productName: 'KendoReact',
|
|
10
10
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
11
|
-
publishDate:
|
|
11
|
+
publishDate: 1681980885,
|
|
12
12
|
version: '',
|
|
13
13
|
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'
|
|
14
14
|
};
|