@progress/kendo-react-dropdowns 5.13.0-dev.202304200559 → 5.13.0-dev.202304201241
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 +44 -45
- package/dist/es/MultiSelect/MultiSelect.js +277 -128
- package/dist/es/MultiSelect/MultiSelectProps.d.ts +44 -1
- 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 +44 -45
- package/dist/npm/MultiSelect/MultiSelect.js +276 -127
- package/dist/npm/MultiSelect/MultiSelectProps.d.ts +44 -1
- 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
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MultiSelect } from './MultiSelect';
|
|
3
3
|
import { FormComponentProps } from '@progress/kendo-react-common';
|
|
4
|
-
import { FilterChangeEvent, ChangeEvent, OpenEvent, CloseEvent, FocusEvent, BlurEvent, PageChangeEvent } from './../common/events';
|
|
4
|
+
import { FilterChangeEvent, ChangeEvent, OpenEvent, CloseEvent, FocusEvent, BlurEvent, PageChangeEvent, CancelEvent } 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
|
/**
|
|
@@ -15,6 +17,11 @@ export interface MultiSelectFilterChangeEvent extends FilterChangeEvent<MultiSel
|
|
|
15
17
|
*/
|
|
16
18
|
export interface MultiSelectChangeEvent extends ChangeEvent<MultiSelect> {
|
|
17
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Represents the object of the `onCancel` MultiSelect event.
|
|
22
|
+
*/
|
|
23
|
+
export interface MultiSelectCancelEvent extends CancelEvent<MultiSelect> {
|
|
24
|
+
}
|
|
18
25
|
/**
|
|
19
26
|
* Represents the object of the `open` MultiSelect event.
|
|
20
27
|
*/
|
|
@@ -151,6 +158,10 @@ export interface MultiSelectProps extends FormComponentProps {
|
|
|
151
158
|
* Sets the value of filtering input. Useful for making the filtering input a [controlled component](https://reactjs.org/docs/forms.html#controlled-components).
|
|
152
159
|
*/
|
|
153
160
|
filter?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Sets the value of the adaptive filtering input of the of ComboBox.
|
|
163
|
+
*/
|
|
164
|
+
adaptiveFilter?: string;
|
|
154
165
|
/**
|
|
155
166
|
* Sets the loading state of the MultiSelect ([see example]({% slug filtering_multiselect %}#toc-basic-configuration)).
|
|
156
167
|
*/
|
|
@@ -199,6 +210,10 @@ export interface MultiSelectProps extends FormComponentProps {
|
|
|
199
210
|
* Fires each time the value of the MultiSelect is about to change ([see examples]({% slug binding_multiselect %})).
|
|
200
211
|
*/
|
|
201
212
|
onChange?: (event: MultiSelectChangeEvent) => void;
|
|
213
|
+
/**
|
|
214
|
+
* Fires each time the popup of the MultiSelect is about to cancel in ([adaptive mode]({% slug adaptive_rendering_multiselect %})).
|
|
215
|
+
*/
|
|
216
|
+
onCancel?: (event: MultiSelectCancelEvent) => void;
|
|
202
217
|
/**
|
|
203
218
|
* Fires each time the user types in the filter input ([see example]({% slug filtering_multiselect %}#toc-basic-configuration)). You can filter the source based on the passed filtration value.
|
|
204
219
|
*/
|
|
@@ -264,4 +279,32 @@ export interface MultiSelectProps extends FormComponentProps {
|
|
|
264
279
|
* @default `solid`
|
|
265
280
|
*/
|
|
266
281
|
fillMode?: null | 'solid' | 'flat' | 'outline';
|
|
282
|
+
/**
|
|
283
|
+
* Sets the data item field that represents the start of a group. Applicable to objects data.
|
|
284
|
+
*/
|
|
285
|
+
groupField?: string;
|
|
286
|
+
/**
|
|
287
|
+
* Fires when a DropDownList's group header item is about to be rendered. Used to override the default appearance of the group's headers.
|
|
288
|
+
*/
|
|
289
|
+
groupHeaderItemRender?: (li: React.ReactElement<HTMLLIElement>, itemProps: ListGroupItemProps) => React.ReactNode;
|
|
290
|
+
/**
|
|
291
|
+
* 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.
|
|
292
|
+
*/
|
|
293
|
+
groupStickyHeaderItemRender?: (div: React.ReactElement<HTMLDivElement>, stickyHeaderProps: GroupStickyHeaderProps) => React.ReactNode;
|
|
294
|
+
/**
|
|
295
|
+
* @hidden
|
|
296
|
+
*/
|
|
297
|
+
list?: any;
|
|
298
|
+
/**
|
|
299
|
+
* @hidden
|
|
300
|
+
*/
|
|
301
|
+
groupMode?: string;
|
|
302
|
+
/**
|
|
303
|
+
* Providing different rendering of the popup element based on the screen dimensions.
|
|
304
|
+
*/
|
|
305
|
+
adaptive?: boolean;
|
|
306
|
+
/**
|
|
307
|
+
* Specifies the text that is rendered as title in the adaptive popup.
|
|
308
|
+
*/
|
|
309
|
+
adaptiveTitle?: string;
|
|
267
310
|
}
|
|
@@ -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: 1681992695,
|
|
9
9
|
version: '',
|
|
10
10
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
11
11
|
};
|
|
@@ -27,6 +27,7 @@ export declare class AutoCompleteWithoutContext extends React.Component<AutoComp
|
|
|
27
27
|
size: PropTypes.Requireable<"small" | "medium" | "large" | null | undefined>;
|
|
28
28
|
rounded: PropTypes.Requireable<"small" | "medium" | "full" | "large" | null | undefined>;
|
|
29
29
|
fillMode: PropTypes.Requireable<"flat" | "outline" | "solid" | null | undefined>;
|
|
30
|
+
groupField: PropTypes.Requireable<string>;
|
|
30
31
|
suggest: PropTypes.Requireable<NonNullable<string | boolean | null | undefined>>;
|
|
31
32
|
placeholder: PropTypes.Requireable<string>;
|
|
32
33
|
value: PropTypes.Requireable<string>;
|
|
@@ -39,6 +40,7 @@ export declare class AutoCompleteWithoutContext extends React.Component<AutoComp
|
|
|
39
40
|
id: PropTypes.Requireable<string>;
|
|
40
41
|
ariaLabelledBy: PropTypes.Requireable<string>;
|
|
41
42
|
ariaDescribedBy: PropTypes.Requireable<string>;
|
|
43
|
+
list: PropTypes.Requireable<any>;
|
|
42
44
|
opened: PropTypes.Requireable<boolean>;
|
|
43
45
|
disabled: PropTypes.Requireable<boolean>;
|
|
44
46
|
dir: PropTypes.Requireable<string>;
|
|
@@ -57,7 +59,9 @@ export declare class AutoCompleteWithoutContext extends React.Component<AutoComp
|
|
|
57
59
|
popupClass: PropTypes.Requireable<string>;
|
|
58
60
|
className: PropTypes.Requireable<string>;
|
|
59
61
|
appendTo: PropTypes.Requireable<any>;
|
|
60
|
-
width: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
62
|
+
width: PropTypes.Requireable<NonNullable<string | number | null | undefined>>; /**
|
|
63
|
+
* @hidden
|
|
64
|
+
*/
|
|
61
65
|
height: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
62
66
|
}>>;
|
|
63
67
|
onOpen: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -82,7 +86,9 @@ export declare class AutoCompleteWithoutContext extends React.Component<AutoComp
|
|
|
82
86
|
height: string;
|
|
83
87
|
};
|
|
84
88
|
required: boolean;
|
|
85
|
-
validityStyles: boolean;
|
|
89
|
+
validityStyles: boolean; /**
|
|
90
|
+
* The value of the AutoComplete.
|
|
91
|
+
*/
|
|
86
92
|
};
|
|
87
93
|
/**
|
|
88
94
|
* @hidden
|
|
@@ -94,6 +100,8 @@ export declare class AutoCompleteWithoutContext extends React.Component<AutoComp
|
|
|
94
100
|
private _suggested;
|
|
95
101
|
private _input;
|
|
96
102
|
private _valueDuringOnChange?;
|
|
103
|
+
private _isScrolling;
|
|
104
|
+
private itemHeight;
|
|
97
105
|
constructor(props: AutoCompleteProps);
|
|
98
106
|
/**
|
|
99
107
|
* @hidden
|
|
@@ -159,6 +167,7 @@ export declare class AutoCompleteWithoutContext extends React.Component<AutoComp
|
|
|
159
167
|
private renderSearchBar;
|
|
160
168
|
private renderListContainer;
|
|
161
169
|
private renderList;
|
|
170
|
+
private onScroll;
|
|
162
171
|
private handleItemClick;
|
|
163
172
|
private onChangeHandler;
|
|
164
173
|
private clearButtonClick;
|
|
@@ -33,6 +33,7 @@ var SearchBar_1 = require("./../common/SearchBar");
|
|
|
33
33
|
var ListContainer_1 = require("./../common/ListContainer");
|
|
34
34
|
var List_1 = require("./../common/List");
|
|
35
35
|
var DropDownBase_1 = require("../common/DropDownBase");
|
|
36
|
+
var GroupStickyHeader_1 = require("../common/GroupStickyHeader");
|
|
36
37
|
var utils_1 = require("../common/utils");
|
|
37
38
|
var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
38
39
|
var kendo_react_labels_1 = require("@progress/kendo-react-labels");
|
|
@@ -55,6 +56,8 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
|
|
|
55
56
|
_this._inputId = (0, kendo_react_common_1.guid)();
|
|
56
57
|
_this._suggested = '';
|
|
57
58
|
_this._input = null;
|
|
59
|
+
_this._isScrolling = false;
|
|
60
|
+
_this.itemHeight = 0;
|
|
58
61
|
/**
|
|
59
62
|
* @hidden
|
|
60
63
|
*/
|
|
@@ -94,6 +97,36 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
|
|
|
94
97
|
: _this.props.validationMessage || VALIDATION_MESSAGE);
|
|
95
98
|
}
|
|
96
99
|
};
|
|
100
|
+
_this.onScroll = function (event) {
|
|
101
|
+
_this._isScrolling = true;
|
|
102
|
+
var list = _this.base.list;
|
|
103
|
+
var groupField = _this.props.groupField;
|
|
104
|
+
var _a = _this.props.data, data = _a === void 0 ? [] : _a;
|
|
105
|
+
if (!groupField || !data.length) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
var itemHeight = _this.itemHeight || (list ? list.children[0].offsetHeight : 0);
|
|
109
|
+
var target = event.target;
|
|
110
|
+
var scrollTop = target.scrollTop;
|
|
111
|
+
if (groupField) {
|
|
112
|
+
data = _this.base.getGroupedDataModernMode(data, groupField);
|
|
113
|
+
}
|
|
114
|
+
;
|
|
115
|
+
var group = data[0][groupField];
|
|
116
|
+
for (var i = 1; i < data.length; i++) {
|
|
117
|
+
if (itemHeight * i > scrollTop) {
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
if (data[i] && data[i][groupField]) {
|
|
121
|
+
group = data[i][groupField];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (group !== _this.state.group) {
|
|
125
|
+
_this.setState({
|
|
126
|
+
group: group
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
};
|
|
97
130
|
_this.handleItemClick = function (index, event) {
|
|
98
131
|
_this.base.handleItemClick(index, event);
|
|
99
132
|
_this._valueDuringOnChange = undefined;
|
|
@@ -152,6 +185,9 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
|
|
|
152
185
|
_this.applyState(state);
|
|
153
186
|
};
|
|
154
187
|
_this.onInputKeyDown = function (event) {
|
|
188
|
+
if (_this._isScrolling) {
|
|
189
|
+
_this._isScrolling = false;
|
|
190
|
+
}
|
|
155
191
|
var keyCode = event.keyCode;
|
|
156
192
|
var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
|
|
157
193
|
var state = _this.base.initState();
|
|
@@ -271,8 +307,9 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
|
|
|
271
307
|
* @hidden
|
|
272
308
|
*/
|
|
273
309
|
AutoCompleteWithoutContext.prototype.componentDidUpdate = function (prevProps, prevState) {
|
|
274
|
-
var _a
|
|
275
|
-
var _b =
|
|
310
|
+
var _a;
|
|
311
|
+
var _b = this.props, _c = _b.groupField, groupField = _c === void 0 ? '' : _c, _d = _b.data, data = _d === void 0 ? [] : _d;
|
|
312
|
+
var _e = prevProps.data, prevData = _e === void 0 ? [] : _e;
|
|
276
313
|
var focusedIndex = this.focusedIndex();
|
|
277
314
|
var focusedItem = data[focusedIndex];
|
|
278
315
|
var dataChanged = prevData !== data;
|
|
@@ -280,8 +317,16 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
|
|
|
280
317
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
281
318
|
var prevOpened = prevProps.opened !== undefined ? prevProps.opened : prevState.opened;
|
|
282
319
|
var opening = !prevOpened && opened;
|
|
283
|
-
if (
|
|
284
|
-
|
|
320
|
+
if (groupField === '') {
|
|
321
|
+
if ((opened && (focusedItemChanged || dataChanged)) || opening) {
|
|
322
|
+
this.base.scrollToItem(focusedIndex);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
else if (!this._isScrolling) {
|
|
326
|
+
var focusedItemIndex = (_a = this.base.getGroupedDataModernMode(data, groupField)) === null || _a === void 0 ? void 0 : _a.indexOf(focusedItem);
|
|
327
|
+
if (opened && prevOpened && focusedItemChanged) {
|
|
328
|
+
this.base.scrollToItem(focusedItemIndex);
|
|
329
|
+
}
|
|
285
330
|
}
|
|
286
331
|
this.setValidity();
|
|
287
332
|
};
|
|
@@ -378,10 +423,14 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
|
|
|
378
423
|
AutoCompleteWithoutContext.prototype.renderListContainer = function () {
|
|
379
424
|
var _a;
|
|
380
425
|
var base = this.base;
|
|
381
|
-
var _b = this.props, dir = _b.dir, header = _b.header, footer = _b.footer, _c = _b.data, data = _c === void 0 ? [] : _c, size = _b.size;
|
|
426
|
+
var _b = this.props, dir = _b.dir, header = _b.header, footer = _b.footer, _c = _b.data, data = _c === void 0 ? [] : _c, size = _b.size, groupField = _b.groupField, list = _b.list, groupStickyHeaderItemRender = _b.groupStickyHeaderItemRender;
|
|
382
427
|
var popupSettings = base.getPopupSettings();
|
|
383
428
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
384
429
|
var popupWidth = popupSettings.width !== undefined ? popupSettings.width : base.popupWidth;
|
|
430
|
+
var group = this.state.group;
|
|
431
|
+
if (group === undefined && groupField !== undefined) {
|
|
432
|
+
group = (0, utils_1.getItemValue)(data[0], groupField);
|
|
433
|
+
}
|
|
385
434
|
return (React.createElement(ListContainer_1.default, { width: popupWidth, popupSettings: {
|
|
386
435
|
animate: popupSettings.animate,
|
|
387
436
|
anchor: this.element,
|
|
@@ -393,16 +442,18 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
|
|
|
393
442
|
header && React.createElement("div", { className: "k-list-header" }, header),
|
|
394
443
|
React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-list', (_a = {},
|
|
395
444
|
_a["k-list-".concat(sizeMap[size] || size)] = size,
|
|
396
|
-
_a)) },
|
|
445
|
+
_a)) },
|
|
446
|
+
!list && group && React.createElement(GroupStickyHeader_1.default, { group: group, groupMode: 'modern', render: groupStickyHeaderItemRender }),
|
|
447
|
+
this.renderList()),
|
|
397
448
|
footer && React.createElement("div", { className: "k-list-footer" }, footer)));
|
|
398
449
|
};
|
|
399
450
|
AutoCompleteWithoutContext.prototype.renderList = function () {
|
|
400
451
|
var base = this.base;
|
|
401
452
|
var popupSettings = base.getPopupSettings();
|
|
402
|
-
var _a = this.props, textField = _a.textField, _b = _a.data, data = _b === void 0 ? [] : _b, listNoDataRender = _a.listNoDataRender, itemRender = _a.itemRender;
|
|
453
|
+
var _a = this.props, textField = _a.textField, _b = _a.data, data = _b === void 0 ? [] : _b, listNoDataRender = _a.listNoDataRender, itemRender = _a.itemRender, groupHeaderItemRender = _a.groupHeaderItemRender;
|
|
403
454
|
var value = this.value;
|
|
404
455
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
405
|
-
return (React.createElement(List_1.default, { id: base.listBoxId, show: opened, data: data.slice(), focusedIndex: this.focusedIndex(), value: value, textField: textField, valueField: textField, highlightSelected: false, optionsGuid: base.guid, listRef: function (list) { return base.list = list; }, wrapperStyle: { maxHeight: popupSettings.height }, wrapperCssClass: "k-list-content", onClick: this.handleItemClick, itemRender: itemRender, noDataRender: listNoDataRender, onMouseDown: function (e) { return e.preventDefault(); } }));
|
|
456
|
+
return (React.createElement(List_1.default, { id: base.listBoxId, show: opened, data: data.slice(), focusedIndex: this.focusedIndex(), value: value, textField: textField, valueField: textField, highlightSelected: false, optionsGuid: base.guid, groupField: this.props.groupField, groupMode: 'modern', listRef: function (list) { return base.list = list; }, wrapperStyle: { maxHeight: popupSettings.height }, wrapperCssClass: "k-list-content", onClick: this.handleItemClick, itemRender: itemRender, groupHeaderItemRender: groupHeaderItemRender, noDataRender: listNoDataRender, onMouseDown: function (e) { return e.preventDefault(); }, onScroll: this.onScroll }));
|
|
406
457
|
};
|
|
407
458
|
AutoCompleteWithoutContext.prototype.triggerOnChange = function (newValue, state, eventArgs) {
|
|
408
459
|
if (this.value === newValue && !eventArgs) {
|
|
@@ -442,7 +493,7 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
|
|
|
442
493
|
/**
|
|
443
494
|
* @hidden
|
|
444
495
|
*/
|
|
445
|
-
AutoCompleteWithoutContext.propTypes = __assign(__assign({}, DropDownBase_1.default.basicPropTypes), { size: PropTypes.oneOf([null, 'small', 'medium', 'large']), rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']), fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline']), suggest: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), placeholder: PropTypes.string, value: PropTypes.string, defaultValue: PropTypes.string, validationMessage: PropTypes.string, required: PropTypes.bool, readonly: PropTypes.bool, clearButton: PropTypes.bool, valueRender: PropTypes.func, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string });
|
|
496
|
+
AutoCompleteWithoutContext.propTypes = __assign(__assign({}, DropDownBase_1.default.basicPropTypes), { size: PropTypes.oneOf([null, 'small', 'medium', 'large']), rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']), fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline']), groupField: PropTypes.string, suggest: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), placeholder: PropTypes.string, value: PropTypes.string, defaultValue: PropTypes.string, validationMessage: PropTypes.string, required: PropTypes.bool, readonly: PropTypes.bool, clearButton: PropTypes.bool, valueRender: PropTypes.func, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string, list: PropTypes.any });
|
|
446
497
|
/**
|
|
447
498
|
* @hidden
|
|
448
499
|
*/
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { AutoComplete } from './AutoComplete';
|
|
3
3
|
import { ChangeEvent, OpenEvent, CloseEvent, FocusEvent, BlurEvent } from './../common/events';
|
|
4
4
|
import { DropDownsPopupSettings, Suggestion } from '../common/settings';
|
|
5
|
+
import { ListGroupItemProps } from '../common/ListGroupItem';
|
|
6
|
+
import { GroupStickyHeaderProps } from '../common/GroupStickyHeader';
|
|
5
7
|
import { ListItemProps } from '../common/ListItem';
|
|
6
8
|
import { FormComponentProps } from '@progress/kendo-react-common';
|
|
7
9
|
/**
|
|
@@ -214,4 +216,24 @@ export interface AutoCompleteProps extends FormComponentProps {
|
|
|
214
216
|
* @default `solid`
|
|
215
217
|
*/
|
|
216
218
|
fillMode?: null | 'solid' | 'flat' | 'outline';
|
|
219
|
+
/**
|
|
220
|
+
* Sets the data item field that represents the start of a group. Applicable to objects data.
|
|
221
|
+
*/
|
|
222
|
+
groupField?: string;
|
|
223
|
+
/**
|
|
224
|
+
* Fires when a AutoComplete group header item is about to be rendered. Used to override the default appearance of the group's headers.
|
|
225
|
+
*/
|
|
226
|
+
groupHeaderItemRender?: (li: React.ReactElement<HTMLLIElement>, itemProps: ListGroupItemProps) => React.ReactNode;
|
|
227
|
+
/**
|
|
228
|
+
* Fires when a AutoComplete sticky group header item is about to be rendered. Used to override the default appearance of the sticky group header of the component.
|
|
229
|
+
*/
|
|
230
|
+
groupStickyHeaderItemRender?: (div: React.ReactElement<HTMLDivElement>, stickyHeaderProps: GroupStickyHeaderProps) => React.ReactNode;
|
|
231
|
+
/**
|
|
232
|
+
* @hidden
|
|
233
|
+
*/
|
|
234
|
+
list?: any;
|
|
235
|
+
/**
|
|
236
|
+
* Sets the key for comparing the data items of the AutoComplete. If `dataItemKey` is not set, the AutoComplete compares the items by reference.
|
|
237
|
+
*/
|
|
238
|
+
dataItemKey?: string;
|
|
217
239
|
}
|
|
@@ -25,6 +25,8 @@ export declare class ComboBoxWithoutContext extends React.Component<ComboBoxProp
|
|
|
25
25
|
fillMode: PropTypes.Requireable<"flat" | "outline" | "solid" | null | undefined>;
|
|
26
26
|
dataItemKey: PropTypes.Requireable<string>;
|
|
27
27
|
groupField: PropTypes.Requireable<string>;
|
|
28
|
+
groupMode: PropTypes.Requireable<string | undefined>;
|
|
29
|
+
isMultiColumn: PropTypes.Requireable<boolean>;
|
|
28
30
|
suggest: PropTypes.Requireable<boolean>;
|
|
29
31
|
placeholder: PropTypes.Requireable<string>;
|
|
30
32
|
allowCustom: PropTypes.Requireable<boolean>;
|
|
@@ -56,7 +58,7 @@ export declare class ComboBoxWithoutContext extends React.Component<ComboBoxProp
|
|
|
56
58
|
opened: PropTypes.Requireable<boolean>;
|
|
57
59
|
disabled: PropTypes.Requireable<boolean>;
|
|
58
60
|
dir: PropTypes.Requireable<string>;
|
|
59
|
-
tabIndex: PropTypes.Requireable<number>;
|
|
61
|
+
tabIndex: PropTypes.Requireable<number>; /** @hidden */
|
|
60
62
|
accessKey: PropTypes.Requireable<string>;
|
|
61
63
|
data: PropTypes.Requireable<any[]>;
|
|
62
64
|
textField: PropTypes.Requireable<string>;
|
|
@@ -93,6 +95,8 @@ export declare class ComboBoxWithoutContext extends React.Component<ComboBoxProp
|
|
|
93
95
|
allowCustom: boolean;
|
|
94
96
|
clearButton: boolean;
|
|
95
97
|
required: boolean;
|
|
98
|
+
groupMode: string | undefined;
|
|
99
|
+
isMultiColumn: boolean;
|
|
96
100
|
popupSettings: {
|
|
97
101
|
height: string;
|
|
98
102
|
};
|