@progress/kendo-react-dropdowns 5.1.0-dev.202202221154 → 5.1.0-dev.202202240928
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/ComboBox/ComboBox.js +23 -14
- package/dist/es/ComboBox/ComboBoxProps.d.ts +6 -0
- package/dist/es/DropDownList/DropDownList.d.ts +4 -1
- package/dist/es/DropDownList/DropDownList.js +3 -3
- package/dist/es/DropDownList/DropDownListProps.d.ts +4 -0
- package/dist/es/MultiColumnComboBox/MultiColumnComboBox.d.ts +6 -0
- package/dist/es/MultiColumnComboBox/MultiColumnComboBox.js +27 -16
- package/dist/es/common/List.d.ts +1 -0
- package/dist/es/common/List.js +3 -3
- package/dist/es/common/ListItem.d.ts +4 -0
- package/dist/es/common/ListItem.js +3 -3
- package/dist/es/common/MultiColumnList.js +1 -1
- package/dist/es/package-metadata.js +1 -1
- package/dist/npm/ComboBox/ComboBox.js +23 -14
- package/dist/npm/ComboBox/ComboBoxProps.d.ts +6 -0
- package/dist/npm/DropDownList/DropDownList.d.ts +4 -1
- package/dist/npm/DropDownList/DropDownList.js +3 -3
- package/dist/npm/DropDownList/DropDownListProps.d.ts +4 -0
- package/dist/npm/MultiColumnComboBox/MultiColumnComboBox.d.ts +6 -0
- package/dist/npm/MultiColumnComboBox/MultiColumnComboBox.js +26 -15
- package/dist/npm/common/List.d.ts +1 -0
- package/dist/npm/common/List.js +3 -3
- package/dist/npm/common/ListItem.d.ts +4 -0
- package/dist/npm/common/ListItem.js +3 -3
- package/dist/npm/common/MultiColumnList.js +1 -1
- package/dist/npm/package-metadata.js +1 -1
- package/dist/systemjs/kendo-react-dropdowns.js +1 -1
- package/package.json +12 -12
|
@@ -107,6 +107,9 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
107
107
|
_this.setState({
|
|
108
108
|
group: group
|
|
109
109
|
});
|
|
110
|
+
if (_this.props.onGroupScroll) {
|
|
111
|
+
_this.props.onGroupScroll.call(undefined, { group: group });
|
|
112
|
+
}
|
|
110
113
|
}
|
|
111
114
|
};
|
|
112
115
|
_this.handleItemClick = function (index, event) {
|
|
@@ -379,9 +382,7 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
379
382
|
_a['k-loading'] = loading,
|
|
380
383
|
_a['k-required'] = this.required,
|
|
381
384
|
_a['k-disabled'] = disabled,
|
|
382
|
-
_a), className), ref: this.componentRef, style: !label
|
|
383
|
-
? style
|
|
384
|
-
: __assign({}, style, { width: undefined }), dir: dir },
|
|
385
|
+
_a), className), ref: this.componentRef, style: !label ? style : __assign({}, style, { width: undefined }), dir: dir },
|
|
385
386
|
this.renderSearchBar(inputText || '', id),
|
|
386
387
|
renderClearButton && !loading && React.createElement(ClearButton, { onClick: this.clearButtonClick, key: "clearbutton" }),
|
|
387
388
|
loading && React.createElement("span", { className: "k-icon k-i-loading", key: "loading" }),
|
|
@@ -509,7 +510,7 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
509
510
|
ComboBoxWithoutContext.prototype.renderListContainer = function () {
|
|
510
511
|
var _a;
|
|
511
512
|
var base = this.base;
|
|
512
|
-
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;
|
|
513
|
+
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;
|
|
513
514
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
514
515
|
var popupSettings = base.getPopupSettings();
|
|
515
516
|
var popupWidth = popupSettings.width !== undefined ? popupSettings.width : base.popupWidth;
|
|
@@ -521,22 +522,27 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
521
522
|
animate: popupSettings.animate,
|
|
522
523
|
anchor: this.element,
|
|
523
524
|
show: opened,
|
|
524
|
-
popupClass: classNames(popupSettings.popupClass, 'k-
|
|
525
|
-
_a["k-list-" + (sizeMap[size] || size)] = size,
|
|
526
|
-
_a['k-virtual-list'] = this.base.vs.enabled,
|
|
527
|
-
_a)),
|
|
525
|
+
popupClass: classNames(popupSettings.popupClass, 'k-reset'),
|
|
528
526
|
className: popupSettings.className,
|
|
529
527
|
appendTo: popupSettings.appendTo
|
|
530
528
|
}, dir: dir !== undefined ? dir : this.base.dirCalculated, itemsCount: [data.length] },
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
529
|
+
React.createElement("div", { className: classNames((_a = {},
|
|
530
|
+
_a['k-list'] = !list,
|
|
531
|
+
_a["k-list-" + (sizeMap[size] || size)] = !list && size,
|
|
532
|
+
_a['k-virtual-list'] = virtual,
|
|
533
|
+
_a['k-data-table'] = list,
|
|
534
|
+
_a["k-table-" + (sizeMap[size] || size)] = list && size,
|
|
535
|
+
_a)) },
|
|
536
|
+
header && React.createElement("div", { className: "k-table-header" }, header),
|
|
537
|
+
!list && group && React.createElement("div", { className: "k-list-group-sticky-header" }, group),
|
|
538
|
+
this.renderList(),
|
|
539
|
+
footer && React.createElement("div", { className: "k-list-footer" }, footer))));
|
|
535
540
|
};
|
|
536
541
|
ComboBoxWithoutContext.prototype.renderList = function () {
|
|
537
542
|
var _this = this;
|
|
543
|
+
var _a;
|
|
538
544
|
var base = this.base;
|
|
539
|
-
var
|
|
545
|
+
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;
|
|
540
546
|
var popupSettings = base.getPopupSettings();
|
|
541
547
|
var vs = base.vs;
|
|
542
548
|
var skip = virtual.skip;
|
|
@@ -547,7 +553,10 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
547
553
|
var selectedItemText = getItemValue(this.value, textField);
|
|
548
554
|
var value = isPresent(text) && text !== selectedItemText ? null : this.value;
|
|
549
555
|
var ListComponent = this.props.list || List;
|
|
550
|
-
return (React.createElement(ListComponent, { id: base.listBoxId, 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: { maxHeight: popupSettings.height }, wrapperCssClass:
|
|
556
|
+
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: { maxHeight: popupSettings.height }, wrapperCssClass: classNames('k-list-content', (_a = {},
|
|
557
|
+
_a['k-list-scroller'] = !virtual,
|
|
558
|
+
_a['k-virtual-content'] = virtual,
|
|
559
|
+
_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() }));
|
|
551
560
|
};
|
|
552
561
|
ComboBoxWithoutContext.prototype.renderSearchBar = function (text, id) {
|
|
553
562
|
var _this = this;
|
|
@@ -209,6 +209,12 @@ export interface ComboBoxProps extends FormComponentProps {
|
|
|
209
209
|
* 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.
|
|
210
210
|
*/
|
|
211
211
|
listNoDataRender?: (element: React.ReactElement<HTMLDivElement>) => React.ReactNode;
|
|
212
|
+
/**
|
|
213
|
+
* @hidden
|
|
214
|
+
*/
|
|
215
|
+
onGroupScroll?: (event: {
|
|
216
|
+
group?: string;
|
|
217
|
+
}) => void;
|
|
212
218
|
/**
|
|
213
219
|
* Sets the header component of the ComboBox ([see example]({% slug customrendering_combobox %}#toc-headers-and-footers)).
|
|
214
220
|
*/
|
|
@@ -25,7 +25,9 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
|
|
|
25
25
|
virtual: PropTypes.Requireable<PropTypes.InferProps<{
|
|
26
26
|
pageSize: PropTypes.Validator<number>;
|
|
27
27
|
skip: PropTypes.Validator<number>;
|
|
28
|
-
total: PropTypes.Validator<number>;
|
|
28
|
+
total: PropTypes.Validator<number>; /**
|
|
29
|
+
* The value of the DropDownList.
|
|
30
|
+
*/
|
|
29
31
|
}>>;
|
|
30
32
|
onFilterChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
31
33
|
onPageChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -71,6 +73,7 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
|
|
|
71
73
|
id: PropTypes.Requireable<string>;
|
|
72
74
|
ariaLabelledBy: PropTypes.Requireable<string>;
|
|
73
75
|
ariaDescribedBy: PropTypes.Requireable<string>;
|
|
76
|
+
ariaLabel: PropTypes.Requireable<string>;
|
|
74
77
|
leftRightKeysNavigation: PropTypes.Requireable<boolean>;
|
|
75
78
|
title: PropTypes.Requireable<string>;
|
|
76
79
|
};
|
|
@@ -515,10 +515,10 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
515
515
|
_a['k-required'] = this.required,
|
|
516
516
|
_a)), style: !label
|
|
517
517
|
? style
|
|
518
|
-
: __assign({}, style, { width: undefined }), dir: dir, onMouseDown: opened ? preventDefaultNonInputs : undefined, onFocus: this.handleFocus, onBlur: this.handleBlur, tabIndex: getTabIndex(tabIndex, disabled), accessKey: this.props.accessKey, onKeyDown: this.handleKeyDown, onKeyPress: this.handleKeyPress, onClick: disabled ? undefined : this.handleWrapperClick, role: 'listbox', "aria-disabled": disabled || undefined, "aria-haspopup": true, "aria-expanded": opened || false, "aria-owns": this.base.listBoxId, "aria-activedescendant": opened ? ('option-' + this.base.guid + '-' + (selectedIndex + (virtual ? virtual.skip : 0))) : undefined, "aria-label": this.props.label, "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, id: this.props.id, title: this.props.title },
|
|
518
|
+
: __assign({}, style, { width: undefined }), dir: dir, onMouseDown: opened ? preventDefaultNonInputs : undefined, onFocus: this.handleFocus, onBlur: this.handleBlur, tabIndex: getTabIndex(tabIndex, disabled), accessKey: this.props.accessKey, onKeyDown: this.handleKeyDown, onKeyPress: this.handleKeyPress, onClick: disabled ? undefined : this.handleWrapperClick, role: 'listbox', "aria-disabled": disabled || undefined, "aria-haspopup": true, "aria-expanded": opened || false, "aria-owns": this.base.listBoxId, "aria-activedescendant": opened ? ('option-' + this.base.guid + '-' + (selectedIndex + (virtual ? virtual.skip : 0))) : undefined, "aria-label": this.props.ariaLabel || this.props.label, "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, id: this.props.id, title: this.props.title },
|
|
519
519
|
valueElement,
|
|
520
520
|
loading && React.createElement("span", { className: "k-icon k-i-loading", key: "loading" }),
|
|
521
|
-
React.createElement("button", { tabIndex: -1, type: "button", className: classNames('k-input-button k-button k-icon-button', (_b = {},
|
|
521
|
+
React.createElement("button", { tabIndex: -1, type: "button", "aria-hidden": true, className: classNames('k-input-button k-button k-icon-button', (_b = {},
|
|
522
522
|
_b["k-button-" + (sizeMap[size] || size)] = size,
|
|
523
523
|
_b["k-button-" + fillMode] = fillMode,
|
|
524
524
|
_b["k-button-" + fillMode + "-base"] = fillMode,
|
|
@@ -585,7 +585,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
585
585
|
/**
|
|
586
586
|
* @hidden
|
|
587
587
|
*/
|
|
588
|
-
DropDownListWithoutContext.propTypes = __assign({ delay: PropTypes.number, ignoreCase: PropTypes.bool, iconClassName: PropTypes.string, defaultItem: PropTypes.any, valueRender: PropTypes.func, valueMap: PropTypes.func, validationMessage: PropTypes.string, required: PropTypes.bool, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string, leftRightKeysNavigation: PropTypes.bool, title: PropTypes.string }, DropDownBase.propTypes);
|
|
588
|
+
DropDownListWithoutContext.propTypes = __assign({ delay: PropTypes.number, ignoreCase: PropTypes.bool, iconClassName: PropTypes.string, 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.propTypes);
|
|
589
589
|
/**
|
|
590
590
|
* @hidden
|
|
591
591
|
*/
|
|
@@ -162,6 +162,10 @@ export interface DropDownListProps extends FormComponentProps {
|
|
|
162
162
|
* Identifies the element(s) which will label the component.
|
|
163
163
|
*/
|
|
164
164
|
ariaLabelledBy?: string;
|
|
165
|
+
/**
|
|
166
|
+
* The accessible label of the component. By default is set to value of `label` prop.
|
|
167
|
+
*/
|
|
168
|
+
ariaLabel?: string;
|
|
165
169
|
/**
|
|
166
170
|
* Configures the popup of the DropDownList.
|
|
167
171
|
*/
|
|
@@ -139,6 +139,12 @@ export interface MultiColumnComboBoxProps extends ComboBoxProps {
|
|
|
139
139
|
* Fires when both the virtual scrolling of the MultiColumnComboBox is enabled and the component requires data for another page.
|
|
140
140
|
*/
|
|
141
141
|
onPageChange?: (event: ComboBoxPageChangeEvent) => void;
|
|
142
|
+
/**
|
|
143
|
+
* @hidden
|
|
144
|
+
*/
|
|
145
|
+
onGroupScroll?: (event: {
|
|
146
|
+
group: string;
|
|
147
|
+
}) => void;
|
|
142
148
|
/**
|
|
143
149
|
* Fires when a MultiColumnComboBox list item is about to be rendered. Used to override the default appearance of the list items.
|
|
144
150
|
*/
|
|
@@ -21,9 +21,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
import * as React from 'react';
|
|
22
22
|
import * as PropTypes from 'prop-types';
|
|
23
23
|
import { MultiColumnList } from './../common/MultiColumnList';
|
|
24
|
-
import { classNames, getScrollbarWidth, setScrollbarWidth,
|
|
24
|
+
import { classNames, getScrollbarWidth, setScrollbarWidth, getter, usePropsContext, createPropsContext } from '@progress/kendo-react-common';
|
|
25
25
|
import { ComboBox, ComboBoxWithoutContext } from '../ComboBox/ComboBox';
|
|
26
|
-
|
|
26
|
+
import { getItemValue } from '../common/utils';
|
|
27
27
|
var columnWidth = function (width, defaultWidth) {
|
|
28
28
|
if (width) {
|
|
29
29
|
return typeof width === 'number' ? width + 'px' : width;
|
|
@@ -45,12 +45,11 @@ export var MultiColumnComboBoxPropsContext = createPropsContext();
|
|
|
45
45
|
*
|
|
46
46
|
*/
|
|
47
47
|
export var MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
48
|
-
var _a;
|
|
49
48
|
var props = usePropsContext(MultiColumnComboBoxPropsContext, directProps);
|
|
50
49
|
var target = React.useRef(null);
|
|
51
50
|
var comboBoxRef = React.useRef(null);
|
|
52
51
|
var scrollbarWidth = getScrollbarWidth();
|
|
53
|
-
var
|
|
52
|
+
var _a = props.columns, columns = _a === void 0 ? defaultProps.columns : _a, _b = props.popupSettings, popupSettings = _b === void 0 ? defaultProps.popupSettings : _b, size = props.size, onOpen = props.onOpen, onClose = props.onClose, onFocus = props.onFocus, onBlur = props.onBlur, onChange = props.onChange, onFilterChange = props.onFilterChange, onPageChange = props.onPageChange, other = __rest(props, ["columns", "popupSettings", "size", "onOpen", "onClose", "onFocus", "onBlur", "onChange", "onFilterChange", "onPageChange"]);
|
|
54
53
|
React.useImperativeHandle(target, function () {
|
|
55
54
|
return ({
|
|
56
55
|
element: comboBoxRef.current && comboBoxRef.current.element,
|
|
@@ -65,12 +64,15 @@ export var MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
65
64
|
});
|
|
66
65
|
});
|
|
67
66
|
React.useImperativeHandle(ref, function () { return target.current; });
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
var initialGroupHeader = React.useMemo(function () {
|
|
68
|
+
if (initialGroupHeader === undefined && props.groupField !== undefined && props.data) {
|
|
69
|
+
return getItemValue(props.data[0], props.groupField);
|
|
70
|
+
}
|
|
71
|
+
}, [props.data, props.groupField]);
|
|
72
|
+
var _c = React.useState(initialGroupHeader), groupHeader = _c[0], setGroupHeader = _c[1];
|
|
73
|
+
var header = React.useMemo(function () {
|
|
74
|
+
return (React.createElement(React.Fragment, null,
|
|
75
|
+
props.header,
|
|
74
76
|
React.createElement("div", { className: "k-table-header-wrap" },
|
|
75
77
|
React.createElement("table", { className: "k-table", role: "presentation" },
|
|
76
78
|
React.createElement("colgroup", null, columns.map(function (column, i) {
|
|
@@ -79,7 +81,14 @@ export var MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
79
81
|
React.createElement("thead", { className: 'k-table-thead' },
|
|
80
82
|
React.createElement("tr", { className: 'k-table-row' }, columns.map(function (column, i) {
|
|
81
83
|
return (React.createElement("th", { className: "k-table-th", key: column.uniqueKey ? column.uniqueKey : i }, column.header || '\u00A0'));
|
|
82
|
-
}))
|
|
84
|
+
})),
|
|
85
|
+
groupHeader && React.createElement("tr", { className: 'k-table-group-row' },
|
|
86
|
+
React.createElement("th", { className: 'k-table-th', colSpan: columns.length }, groupHeader)))))));
|
|
87
|
+
}, [props.header, columns, groupHeader]);
|
|
88
|
+
var popupWidth = React.useMemo(function () {
|
|
89
|
+
// These additional 4px are coming from the child elements side borders (fixes horizontal scrollbar)
|
|
90
|
+
return "calc(" + columns.map(function (column) { return columnWidth(column.width, defaultProps.width); }).filter(Boolean).join(' + ') + " + " + scrollbarWidth + "px + 4px)";
|
|
91
|
+
}, [columns, scrollbarWidth]);
|
|
83
92
|
var skip = props.virtual ? props.virtual.skip : 0;
|
|
84
93
|
var itemRender = React.useCallback(function (li, liProps) {
|
|
85
94
|
var children = columns.map(function (column, i) { return (React.createElement("span", { className: "k-table-td", style: { width: column.width ? column.width : defaultProps.width }, key: column.uniqueKey ? column.uniqueKey : i }, column.field ? getter(column.field)(liProps.dataItem) : '')); });
|
|
@@ -95,13 +104,14 @@ export var MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
95
104
|
}
|
|
96
105
|
}
|
|
97
106
|
if (group) {
|
|
98
|
-
children.push(React.createElement("div", { key: "group", className: "k-
|
|
107
|
+
children.push(React.createElement("div", { key: "group", className: "k-table-td k-table-group-td" },
|
|
99
108
|
React.createElement("span", null, group)));
|
|
100
109
|
}
|
|
101
110
|
var rendering = React.cloneElement(li, __assign({}, li.props, { className: classNames('k-table-row', {
|
|
102
111
|
'k-table-alt-row': liProps.index % 2 !== 0,
|
|
103
112
|
'k-focus': liProps.focused,
|
|
104
|
-
'k-selected': liProps.selected
|
|
113
|
+
'k-selected': liProps.selected,
|
|
114
|
+
'k-first': Boolean(group)
|
|
105
115
|
}) }), children);
|
|
106
116
|
return props.itemRender ? props.itemRender.call(undefined, rendering, liProps) : rendering;
|
|
107
117
|
}, [columns, props.groupField, props.itemRender, props.data, skip]);
|
|
@@ -117,11 +127,12 @@ export var MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
117
127
|
var onChangeHandler = React.useCallback(function (event) { return handleEvent(onChange, event); }, [onChange]);
|
|
118
128
|
var onFilterChangeHandler = React.useCallback(function (event) { return handleEvent(onFilterChange, event); }, [onFilterChange]);
|
|
119
129
|
var onPageChangeHandler = React.useCallback(function (event) { return handleEvent(onPageChange, event); }, [onPageChange]);
|
|
130
|
+
var onGroupScroll = React.useCallback(function (event) {
|
|
131
|
+
setGroupHeader(event.group);
|
|
132
|
+
}, []);
|
|
120
133
|
React.useEffect(function () { setScrollbarWidth(); });
|
|
121
134
|
var List = React.useCallback(function (listProps) { return React.createElement(MultiColumnList, __assign({}, listProps)); }, []);
|
|
122
|
-
return (React.createElement(ComboBox, __assign({}, other, { list: List, popupSettings: __assign({ width: popupWidth }, popupSettings, { popupClass:
|
|
123
|
-
_a["k-table-" + (sizeMap[size] || size)] = size,
|
|
124
|
-
_a)), 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 })));
|
|
135
|
+
return (React.createElement(ComboBox, __assign({}, other, { list: List, popupSettings: __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 })));
|
|
125
136
|
});
|
|
126
137
|
var propTypes = __assign({}, ComboBoxWithoutContext.propTypes, { columns: PropTypes.any.isRequired });
|
|
127
138
|
var defaultProps = {
|
package/dist/es/common/List.d.ts
CHANGED
package/dist/es/common/List.js
CHANGED
|
@@ -26,7 +26,7 @@ var List = /** @class */ (function (_super) {
|
|
|
26
26
|
}
|
|
27
27
|
List.prototype.renderItems = function () {
|
|
28
28
|
var _this = this;
|
|
29
|
-
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, focusedIndex = _a.focusedIndex, _c = _a.highlightSelected, highlightSelected = _c === void 0 ? true : _c, value = _a.value, data = _a.data, itemRender = _a.itemRender;
|
|
29
|
+
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;
|
|
30
30
|
var isArray = Array.isArray(value);
|
|
31
31
|
return data.map(function (item, index) {
|
|
32
32
|
var realIndex = skip + index;
|
|
@@ -42,7 +42,7 @@ var List = /** @class */ (function (_super) {
|
|
|
42
42
|
group = current;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
return (React.createElement(ListItem, { id: "option-" + optionsGuid + "-" + realIndex, dataItem: item, selected: selected, focused: focusedIndex === index, index: realIndex, key: realIndex, onClick: _this.props.onClick, textField: textField, group: group, render: itemRender }));
|
|
45
|
+
return (React.createElement(ListItem, { id: "option-" + optionsGuid + "-" + realIndex, virtual: virtual, dataItem: item, selected: selected, focused: focusedIndex === index, index: realIndex, key: realIndex, onClick: _this.props.onClick, textField: textField, group: group, render: itemRender }));
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
48
|
List.prototype.renderNoValueElement = function (localizationService) {
|
|
@@ -58,7 +58,7 @@ var List = /** @class */ (function (_super) {
|
|
|
58
58
|
var items = this.renderItems();
|
|
59
59
|
return (items.length ? (React.createElement("div", { className: wrapperCssClass, style: wrapperStyle, ref: wrapperRef, onMouseDown: this.props.onMouseDown, onBlur: this.props.onBlur, onScroll: this.props.onScroll, unselectable: "on" },
|
|
60
60
|
React.createElement("ul", { id: id, role: "listbox", "aria-hidden": !show ? true : undefined, className: listClassName, ref: listRef, style: listStyle }, items),
|
|
61
|
-
this.props.scroller)) : this.renderNoValueElement(localizationService));
|
|
61
|
+
this.props.scroller && React.createElement("div", { className: "k-height-container" }, this.props.scroller))) : this.renderNoValueElement(localizationService));
|
|
62
62
|
};
|
|
63
63
|
return List;
|
|
64
64
|
}(React.Component));
|
|
@@ -31,6 +31,10 @@ export interface ListItemProps {
|
|
|
31
31
|
* Indicates the selected state of the list item element.
|
|
32
32
|
*/
|
|
33
33
|
selected: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* @hidden
|
|
36
|
+
*/
|
|
37
|
+
virtual?: boolean;
|
|
34
38
|
/**
|
|
35
39
|
* Fires when the list item is about to be rendered. Used to override the default appearance of the list item.
|
|
36
40
|
*/
|
|
@@ -26,14 +26,14 @@ var ListItem = /** @class */ (function (_super) {
|
|
|
26
26
|
return _this;
|
|
27
27
|
}
|
|
28
28
|
ListItem.prototype.render = function () {
|
|
29
|
-
var _a = this.props, selected = _a.selected, group = _a.group, dataItem = _a.dataItem, renderer = _a.render;
|
|
29
|
+
var _a = this.props, selected = _a.selected, group = _a.group, dataItem = _a.dataItem, virtual = _a.virtual, renderer = _a.render;
|
|
30
30
|
var item = (React.createElement("li", { id: this.props.id, role: "option", "aria-selected": selected, className: classNames('k-list-item', {
|
|
31
31
|
'k-selected': selected,
|
|
32
32
|
'k-focus': this.props.focused,
|
|
33
33
|
'k-first': Boolean(group)
|
|
34
|
-
}), onClick: this.handleClick, style: { position: 'unset' } },
|
|
34
|
+
}), onClick: this.handleClick, style: { position: virtual ? 'relative' : 'unset' } },
|
|
35
35
|
React.createElement("span", { className: 'k-list-item-text' }, getItemValue(dataItem, this.props.textField).toString()),
|
|
36
|
-
group !== undefined ? React.createElement("div", { className: "k-group" }, group) : null));
|
|
36
|
+
group !== undefined ? React.createElement("div", { className: "k-list-item-group-label" }, group) : null));
|
|
37
37
|
return renderer !== undefined ? renderer.call(undefined, item, this.props) : item;
|
|
38
38
|
};
|
|
39
39
|
return ListItem;
|
|
@@ -15,5 +15,5 @@ import List from './List';
|
|
|
15
15
|
* @hidden
|
|
16
16
|
*/
|
|
17
17
|
export var MultiColumnList = function (props) {
|
|
18
|
-
return (React.createElement(List, __assign({}, props, { wrapperCssClass: "k-table-scroller", listClassName: "k-table k-table-list", listStyle: __assign({}, props.listStyle) })));
|
|
18
|
+
return (React.createElement(List, __assign({}, props, { wrapperCssClass: "k-table-body k-table-scroller", listClassName: "k-table k-table-list", listStyle: __assign({}, props.listStyle) })));
|
|
19
19
|
};
|
|
@@ -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: 1645693883,
|
|
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
|
};
|
|
@@ -109,6 +109,9 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
109
109
|
_this.setState({
|
|
110
110
|
group: group
|
|
111
111
|
});
|
|
112
|
+
if (_this.props.onGroupScroll) {
|
|
113
|
+
_this.props.onGroupScroll.call(undefined, { group: group });
|
|
114
|
+
}
|
|
112
115
|
}
|
|
113
116
|
};
|
|
114
117
|
_this.handleItemClick = function (index, event) {
|
|
@@ -381,9 +384,7 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
381
384
|
_a['k-loading'] = loading,
|
|
382
385
|
_a['k-required'] = this.required,
|
|
383
386
|
_a['k-disabled'] = disabled,
|
|
384
|
-
_a), className), ref: this.componentRef, style: !label
|
|
385
|
-
? style
|
|
386
|
-
: __assign({}, style, { width: undefined }), dir: dir },
|
|
387
|
+
_a), className), ref: this.componentRef, style: !label ? style : __assign({}, style, { width: undefined }), dir: dir },
|
|
387
388
|
this.renderSearchBar(inputText || '', id),
|
|
388
389
|
renderClearButton && !loading && React.createElement(ClearButton_1.default, { onClick: this.clearButtonClick, key: "clearbutton" }),
|
|
389
390
|
loading && React.createElement("span", { className: "k-icon k-i-loading", key: "loading" }),
|
|
@@ -511,7 +512,7 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
511
512
|
ComboBoxWithoutContext.prototype.renderListContainer = function () {
|
|
512
513
|
var _a;
|
|
513
514
|
var base = this.base;
|
|
514
|
-
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;
|
|
515
|
+
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;
|
|
515
516
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
516
517
|
var popupSettings = base.getPopupSettings();
|
|
517
518
|
var popupWidth = popupSettings.width !== undefined ? popupSettings.width : base.popupWidth;
|
|
@@ -523,22 +524,27 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
523
524
|
animate: popupSettings.animate,
|
|
524
525
|
anchor: this.element,
|
|
525
526
|
show: opened,
|
|
526
|
-
popupClass: kendo_react_common_1.classNames(popupSettings.popupClass, 'k-
|
|
527
|
-
_a["k-list-" + (sizeMap[size] || size)] = size,
|
|
528
|
-
_a['k-virtual-list'] = this.base.vs.enabled,
|
|
529
|
-
_a)),
|
|
527
|
+
popupClass: kendo_react_common_1.classNames(popupSettings.popupClass, 'k-reset'),
|
|
530
528
|
className: popupSettings.className,
|
|
531
529
|
appendTo: popupSettings.appendTo
|
|
532
530
|
}, dir: dir !== undefined ? dir : this.base.dirCalculated, itemsCount: [data.length] },
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
531
|
+
React.createElement("div", { className: kendo_react_common_1.classNames((_a = {},
|
|
532
|
+
_a['k-list'] = !list,
|
|
533
|
+
_a["k-list-" + (sizeMap[size] || size)] = !list && size,
|
|
534
|
+
_a['k-virtual-list'] = virtual,
|
|
535
|
+
_a['k-data-table'] = list,
|
|
536
|
+
_a["k-table-" + (sizeMap[size] || size)] = list && size,
|
|
537
|
+
_a)) },
|
|
538
|
+
header && React.createElement("div", { className: "k-table-header" }, header),
|
|
539
|
+
!list && group && React.createElement("div", { className: "k-list-group-sticky-header" }, group),
|
|
540
|
+
this.renderList(),
|
|
541
|
+
footer && React.createElement("div", { className: "k-list-footer" }, footer))));
|
|
537
542
|
};
|
|
538
543
|
ComboBoxWithoutContext.prototype.renderList = function () {
|
|
539
544
|
var _this = this;
|
|
545
|
+
var _a;
|
|
540
546
|
var base = this.base;
|
|
541
|
-
var
|
|
547
|
+
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;
|
|
542
548
|
var popupSettings = base.getPopupSettings();
|
|
543
549
|
var vs = base.vs;
|
|
544
550
|
var skip = virtual.skip;
|
|
@@ -549,7 +555,10 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
549
555
|
var selectedItemText = utils_1.getItemValue(this.value, textField);
|
|
550
556
|
var value = utils_1.isPresent(text) && text !== selectedItemText ? null : this.value;
|
|
551
557
|
var ListComponent = this.props.list || List_1.default;
|
|
552
|
-
return (React.createElement(ListComponent, { id: base.listBoxId, 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: { maxHeight: popupSettings.height }, wrapperCssClass:
|
|
558
|
+
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: { maxHeight: popupSettings.height }, wrapperCssClass: kendo_react_common_1.classNames('k-list-content', (_a = {},
|
|
559
|
+
_a['k-list-scroller'] = !virtual,
|
|
560
|
+
_a['k-virtual-content'] = virtual,
|
|
561
|
+
_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() }));
|
|
553
562
|
};
|
|
554
563
|
ComboBoxWithoutContext.prototype.renderSearchBar = function (text, id) {
|
|
555
564
|
var _this = this;
|
|
@@ -209,6 +209,12 @@ export interface ComboBoxProps extends FormComponentProps {
|
|
|
209
209
|
* 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.
|
|
210
210
|
*/
|
|
211
211
|
listNoDataRender?: (element: React.ReactElement<HTMLDivElement>) => React.ReactNode;
|
|
212
|
+
/**
|
|
213
|
+
* @hidden
|
|
214
|
+
*/
|
|
215
|
+
onGroupScroll?: (event: {
|
|
216
|
+
group?: string;
|
|
217
|
+
}) => void;
|
|
212
218
|
/**
|
|
213
219
|
* Sets the header component of the ComboBox ([see example]({% slug customrendering_combobox %}#toc-headers-and-footers)).
|
|
214
220
|
*/
|
|
@@ -25,7 +25,9 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
|
|
|
25
25
|
virtual: PropTypes.Requireable<PropTypes.InferProps<{
|
|
26
26
|
pageSize: PropTypes.Validator<number>;
|
|
27
27
|
skip: PropTypes.Validator<number>;
|
|
28
|
-
total: PropTypes.Validator<number>;
|
|
28
|
+
total: PropTypes.Validator<number>; /**
|
|
29
|
+
* The value of the DropDownList.
|
|
30
|
+
*/
|
|
29
31
|
}>>;
|
|
30
32
|
onFilterChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
31
33
|
onPageChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -71,6 +73,7 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
|
|
|
71
73
|
id: PropTypes.Requireable<string>;
|
|
72
74
|
ariaLabelledBy: PropTypes.Requireable<string>;
|
|
73
75
|
ariaDescribedBy: PropTypes.Requireable<string>;
|
|
76
|
+
ariaLabel: PropTypes.Requireable<string>;
|
|
74
77
|
leftRightKeysNavigation: PropTypes.Requireable<boolean>;
|
|
75
78
|
title: PropTypes.Requireable<string>;
|
|
76
79
|
};
|
|
@@ -517,10 +517,10 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
517
517
|
_a['k-required'] = this.required,
|
|
518
518
|
_a)), style: !label
|
|
519
519
|
? style
|
|
520
|
-
: __assign({}, style, { width: undefined }), dir: dir, onMouseDown: opened ? utils_1.preventDefaultNonInputs : undefined, onFocus: this.handleFocus, onBlur: this.handleBlur, tabIndex: kendo_react_common_1.getTabIndex(tabIndex, disabled), accessKey: this.props.accessKey, onKeyDown: this.handleKeyDown, onKeyPress: this.handleKeyPress, onClick: disabled ? undefined : this.handleWrapperClick, role: 'listbox', "aria-disabled": disabled || undefined, "aria-haspopup": true, "aria-expanded": opened || false, "aria-owns": this.base.listBoxId, "aria-activedescendant": opened ? ('option-' + this.base.guid + '-' + (selectedIndex + (virtual ? virtual.skip : 0))) : undefined, "aria-label": this.props.label, "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, id: this.props.id, title: this.props.title },
|
|
520
|
+
: __assign({}, style, { width: undefined }), dir: dir, onMouseDown: opened ? utils_1.preventDefaultNonInputs : undefined, onFocus: this.handleFocus, onBlur: this.handleBlur, tabIndex: kendo_react_common_1.getTabIndex(tabIndex, disabled), accessKey: this.props.accessKey, onKeyDown: this.handleKeyDown, onKeyPress: this.handleKeyPress, onClick: disabled ? undefined : this.handleWrapperClick, role: 'listbox', "aria-disabled": disabled || undefined, "aria-haspopup": true, "aria-expanded": opened || false, "aria-owns": this.base.listBoxId, "aria-activedescendant": opened ? ('option-' + this.base.guid + '-' + (selectedIndex + (virtual ? virtual.skip : 0))) : undefined, "aria-label": this.props.ariaLabel || this.props.label, "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, id: this.props.id, title: this.props.title },
|
|
521
521
|
valueElement,
|
|
522
522
|
loading && React.createElement("span", { className: "k-icon k-i-loading", key: "loading" }),
|
|
523
|
-
React.createElement("button", { tabIndex: -1, type: "button", className: kendo_react_common_1.classNames('k-input-button k-button k-icon-button', (_b = {},
|
|
523
|
+
React.createElement("button", { tabIndex: -1, type: "button", "aria-hidden": true, className: kendo_react_common_1.classNames('k-input-button k-button k-icon-button', (_b = {},
|
|
524
524
|
_b["k-button-" + (sizeMap[size] || size)] = size,
|
|
525
525
|
_b["k-button-" + fillMode] = fillMode,
|
|
526
526
|
_b["k-button-" + fillMode + "-base"] = fillMode,
|
|
@@ -587,7 +587,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
587
587
|
/**
|
|
588
588
|
* @hidden
|
|
589
589
|
*/
|
|
590
|
-
DropDownListWithoutContext.propTypes = __assign({ delay: PropTypes.number, ignoreCase: PropTypes.bool, iconClassName: PropTypes.string, defaultItem: PropTypes.any, valueRender: PropTypes.func, valueMap: PropTypes.func, validationMessage: PropTypes.string, required: PropTypes.bool, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string, leftRightKeysNavigation: PropTypes.bool, title: PropTypes.string }, DropDownBase_1.default.propTypes);
|
|
590
|
+
DropDownListWithoutContext.propTypes = __assign({ delay: PropTypes.number, ignoreCase: PropTypes.bool, iconClassName: PropTypes.string, 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);
|
|
591
591
|
/**
|
|
592
592
|
* @hidden
|
|
593
593
|
*/
|
|
@@ -162,6 +162,10 @@ export interface DropDownListProps extends FormComponentProps {
|
|
|
162
162
|
* Identifies the element(s) which will label the component.
|
|
163
163
|
*/
|
|
164
164
|
ariaLabelledBy?: string;
|
|
165
|
+
/**
|
|
166
|
+
* The accessible label of the component. By default is set to value of `label` prop.
|
|
167
|
+
*/
|
|
168
|
+
ariaLabel?: string;
|
|
165
169
|
/**
|
|
166
170
|
* Configures the popup of the DropDownList.
|
|
167
171
|
*/
|
|
@@ -139,6 +139,12 @@ export interface MultiColumnComboBoxProps extends ComboBoxProps {
|
|
|
139
139
|
* Fires when both the virtual scrolling of the MultiColumnComboBox is enabled and the component requires data for another page.
|
|
140
140
|
*/
|
|
141
141
|
onPageChange?: (event: ComboBoxPageChangeEvent) => void;
|
|
142
|
+
/**
|
|
143
|
+
* @hidden
|
|
144
|
+
*/
|
|
145
|
+
onGroupScroll?: (event: {
|
|
146
|
+
group: string;
|
|
147
|
+
}) => void;
|
|
142
148
|
/**
|
|
143
149
|
* Fires when a MultiColumnComboBox list item is about to be rendered. Used to override the default appearance of the list items.
|
|
144
150
|
*/
|