@progress/kendo-react-dropdowns 5.13.0-dev.202304180747 → 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/DropDownTree/DropDownTree.js +81 -26
- package/dist/es/DropDownTree/DropDownTreeProps.d.ts +8 -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/AdaptiveMode.js +1 -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/DropDownTree/DropDownTree.js +80 -25
- package/dist/npm/DropDownTree/DropDownTreeProps.d.ts +8 -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/AdaptiveMode.js +1 -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
|
@@ -34,6 +34,7 @@ var kendo_react_labels_1 = require("@progress/kendo-react-labels");
|
|
|
34
34
|
var kendo_svg_icons_1 = require("@progress/kendo-svg-icons");
|
|
35
35
|
var ListContainer_1 = require("../common/ListContainer");
|
|
36
36
|
var ListFilter_1 = require("../common/ListFilter");
|
|
37
|
+
var GroupStickyHeader_1 = require("../common/GroupStickyHeader");
|
|
37
38
|
var ListDefaultItem_1 = require("../common/ListDefaultItem");
|
|
38
39
|
var List_1 = require("../common/List");
|
|
39
40
|
var DropDownBase_1 = require("../common/DropDownBase");
|
|
@@ -66,6 +67,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
66
67
|
_this._filterInput = null;
|
|
67
68
|
_this._navigated = false;
|
|
68
69
|
_this._inputId = (0, kendo_react_common_1.guid)();
|
|
70
|
+
_this.itemHeight = 0;
|
|
69
71
|
/**
|
|
70
72
|
* @hidden
|
|
71
73
|
*/
|
|
@@ -99,7 +101,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
99
101
|
};
|
|
100
102
|
_this.renderListContainer = function () {
|
|
101
103
|
var _a;
|
|
102
|
-
var _b = _this.props, header = _b.header, footer = _b.footer, dir = _b.dir, _c = _b.data, data = _c === void 0 ? [] : _c, size = _b.size;
|
|
104
|
+
var _b = _this.props, header = _b.header, footer = _b.footer, dir = _b.dir, _c = _b.data, data = _c === void 0 ? [] : _c, size = _b.size, groupField = _b.groupField, groupStickyHeaderItemRender = _b.groupStickyHeaderItemRender, list = _b.list;
|
|
103
105
|
var base = _this.base;
|
|
104
106
|
var popupSettings = base.getPopupSettings();
|
|
105
107
|
var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
|
|
@@ -119,24 +121,57 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
119
121
|
},
|
|
120
122
|
itemsCount: [data.length]
|
|
121
123
|
};
|
|
124
|
+
var group = _this.state.group;
|
|
125
|
+
if (group === undefined && groupField !== undefined) {
|
|
126
|
+
group = (0, utils_1.getItemValue)(data[0], groupField);
|
|
127
|
+
}
|
|
122
128
|
return (React.createElement(ListContainer_1.default, __assign({}, listContainerProps),
|
|
123
129
|
_this.renderListFilter(),
|
|
124
130
|
header && React.createElement("div", { className: "k-list-header" }, header),
|
|
125
131
|
React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-list', (_a = {}, _a["k-list-".concat(sizeMap[size] || size)] = size, _a['k-virtual-list'] = _this.base.vs.enabled, _a)) },
|
|
126
132
|
_this.renderDefaultItem(),
|
|
133
|
+
!list && group && React.createElement(GroupStickyHeader_1.default, { group: group, groupMode: 'modern', render: groupStickyHeaderItemRender }),
|
|
127
134
|
_this.renderList()),
|
|
128
135
|
footer && React.createElement("div", { className: "k-list-footer" }, footer)));
|
|
129
136
|
};
|
|
130
137
|
_this.renderList = function () {
|
|
131
|
-
var _a = _this.props, _b = _a.data, data = _b === void 0 ? [] : _b, textField = _a.textField, dataItemKey = _a.dataItemKey, _c = _a.virtual, virtual = _c === void 0 ? { skip: 0 } : _c, listNoDataRender = _a.listNoDataRender, itemRender = _a.itemRender;
|
|
138
|
+
var _a = _this.props, _b = _a.data, data = _b === void 0 ? [] : _b, textField = _a.textField, dataItemKey = _a.dataItemKey, _c = _a.virtual, virtual = _c === void 0 ? { skip: 0 } : _c, groupHeaderItemRender = _a.groupHeaderItemRender, listNoDataRender = _a.listNoDataRender, itemRender = _a.itemRender;
|
|
132
139
|
var vs = _this.base.vs;
|
|
133
140
|
var skip = virtual.skip;
|
|
134
141
|
var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
|
|
135
142
|
var popupSettings = _this.base.getPopupSettings();
|
|
136
143
|
var translate = "translateY(".concat(vs.translate, "px)");
|
|
137
|
-
return (React.createElement(List_1.default, { id: _this.base.listBoxId, show: opened, data: data.slice(), focusedIndex: _this.focusedIndex(), value: _this.value, textField: textField, valueField: dataItemKey, optionsGuid: _this.base.guid, listRef: function (list) { return vs.list = _this.base.list = list; }, wrapperStyle: { maxHeight: popupSettings.height }, wrapperCssClass: "k-list-content", listStyle: vs.enabled ? { transform: translate } : undefined, key: "listkey", skip: skip, onClick: _this.handleItemClick, itemRender: itemRender, noDataRender: listNoDataRender, onScroll:
|
|
138
|
-
|
|
139
|
-
|
|
144
|
+
return (React.createElement(List_1.default, { id: _this.base.listBoxId, show: opened, data: data.slice(), focusedIndex: _this.focusedIndex(), value: _this.value, textField: textField, valueField: dataItemKey, optionsGuid: _this.base.guid, groupField: _this.props.groupField, groupMode: 'modern', listRef: function (list) { return vs.list = _this.base.list = list; }, wrapperStyle: { maxHeight: popupSettings.height }, wrapperCssClass: "k-list-content", listStyle: vs.enabled ? { transform: translate } : undefined, key: "listkey", skip: skip, onClick: _this.handleItemClick, itemRender: itemRender, groupHeaderItemRender: groupHeaderItemRender, noDataRender: listNoDataRender, onScroll: _this.onScroll, wrapperRef: vs.scrollerRef, scroller: _this.base.renderScrollElement() }));
|
|
145
|
+
};
|
|
146
|
+
_this.onScroll = function (event) {
|
|
147
|
+
var _a = _this.base, vs = _a.vs, list = _a.list;
|
|
148
|
+
vs.scrollHandler(event);
|
|
149
|
+
var groupField = _this.props.groupField;
|
|
150
|
+
var _b = _this.props.data, data = _b === void 0 ? [] : _b;
|
|
151
|
+
if (!groupField || !data.length) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (groupField) {
|
|
155
|
+
var itemHeight = _this.itemHeight =
|
|
156
|
+
_this.itemHeight || (vs.enabled ? vs.itemHeight : (list ? list.children[0].offsetHeight : 0));
|
|
157
|
+
var target = event.target;
|
|
158
|
+
var scrollTop = target.scrollTop - (vs.skip * itemHeight);
|
|
159
|
+
data = _this.base.getGroupedDataModernMode(data, groupField);
|
|
160
|
+
var group = data[0][groupField];
|
|
161
|
+
for (var i = 1; i < data.length; i++) {
|
|
162
|
+
if (itemHeight * i > scrollTop) {
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
if (data[i] && data[i][groupField]) {
|
|
166
|
+
group = data[i][groupField];
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (group !== _this.state.group) {
|
|
170
|
+
_this.setState({
|
|
171
|
+
group: group
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
140
175
|
};
|
|
141
176
|
_this.renderListFilter = function () {
|
|
142
177
|
var filterText = _this.props.filter !== undefined ? _this.props.filter : _this.state.text;
|
|
@@ -457,7 +492,9 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
457
492
|
* @hidden
|
|
458
493
|
*/
|
|
459
494
|
DropDownListWithoutContext.prototype.componentDidUpdate = function (prevProps, prevState) {
|
|
460
|
-
var _a
|
|
495
|
+
var _a;
|
|
496
|
+
var _b = this.props, dataItemKey = _b.dataItemKey, virtual = _b.virtual, _c = _b.groupField, groupField = _c === void 0 ? '' : _c;
|
|
497
|
+
var _d = this.props.data, data = _d === void 0 ? [] : _d;
|
|
461
498
|
var prevTotal = prevProps.virtual ? prevProps.virtual.total : 0;
|
|
462
499
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
463
500
|
var prevOpened = prevProps.opened !== undefined ? prevProps.opened : prevState.opened;
|
|
@@ -479,6 +516,9 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
479
516
|
var selectedItem_1 = this.value;
|
|
480
517
|
var prevSelectedItem = prevProps.value !== undefined ? prevProps.value : prevState.value;
|
|
481
518
|
var selectedItemIndex = data.findIndex(function (i) { return (0, utils_1.areSame)(i, selectedItem_1, dataItemKey); });
|
|
519
|
+
if (groupField !== '') {
|
|
520
|
+
selectedItemIndex = (_a = this.base.getGroupedDataModernMode(data, groupField)) === null || _a === void 0 ? void 0 : _a.indexOf(selectedItem_1);
|
|
521
|
+
}
|
|
482
522
|
var selectedItemChanged = !(0, utils_1.areSame)(prevSelectedItem, selectedItem_1, dataItemKey);
|
|
483
523
|
if (opening && virtual) {
|
|
484
524
|
this.base.scrollToVirtualItem(virtual, selectedItemIndex);
|
|
@@ -599,7 +639,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
599
639
|
var _a;
|
|
600
640
|
var _this = this;
|
|
601
641
|
var _b = this.state.windowWidth, windowWidth = _b === void 0 ? 0 : _b;
|
|
602
|
-
var _c = this.props, header = _c.header, footer = _c.footer, size = _c.size, adaptiveTitle = _c.adaptiveTitle;
|
|
642
|
+
var _c = this.props, header = _c.header, footer = _c.footer, size = _c.size, adaptiveTitle = _c.adaptiveTitle, groupField = _c.groupField, groupStickyHeaderItemRender = _c.groupStickyHeaderItemRender, list = _c.list, _d = _c.data, data = _d === void 0 ? [] : _d;
|
|
603
643
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
604
644
|
var actionSheetProps = {
|
|
605
645
|
navigatable: false,
|
|
@@ -612,6 +652,10 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
612
652
|
? 'k-adaptive-actionsheet k-actionsheet-fullscreen'
|
|
613
653
|
: 'k-adaptive-actionsheet k-actionsheet-bottom'
|
|
614
654
|
};
|
|
655
|
+
var group = this.state.group;
|
|
656
|
+
if (group === undefined && groupField !== undefined) {
|
|
657
|
+
group = (0, utils_1.getItemValue)(data[0], groupField);
|
|
658
|
+
}
|
|
615
659
|
return (React.createElement(React.Fragment, null,
|
|
616
660
|
React.createElement(kendo_react_layout_1.ActionSheet, __assign({}, actionSheetProps),
|
|
617
661
|
React.createElement(kendo_react_layout_1.ActionSheetHeader, { className: 'k-text-center' },
|
|
@@ -625,6 +669,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
625
669
|
header && React.createElement("div", { className: "k-list-header" }, header),
|
|
626
670
|
React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-list', (_a = {}, _a["k-list-".concat(sizeMap[size] || size)] = size, _a['k-virtual-list'] = this.base.vs.enabled, _a)) },
|
|
627
671
|
this.renderDefaultItem(),
|
|
672
|
+
!list && group && React.createElement(GroupStickyHeader_1.default, { group: group, groupMode: 'modern', render: groupStickyHeaderItemRender }),
|
|
628
673
|
this.renderList()),
|
|
629
674
|
footer && React.createElement("div", { className: "k-list-footer" }, footer)))));
|
|
630
675
|
};
|
|
@@ -674,11 +719,11 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
674
719
|
/**
|
|
675
720
|
* @hidden
|
|
676
721
|
*/
|
|
677
|
-
DropDownListWithoutContext.propTypes = __assign({ delay: PropTypes.number, ignoreCase: PropTypes.bool, iconClassName: PropTypes.string, svgIcon: kendo_react_common_1.svgIconPropType, defaultItem: PropTypes.any, valueRender: PropTypes.func, valueMap: PropTypes.func, validationMessage: PropTypes.string, required: PropTypes.bool, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string, ariaLabel: PropTypes.string, leftRightKeysNavigation: PropTypes.bool, title: PropTypes.string }, DropDownBase_1.default.propTypes);
|
|
722
|
+
DropDownListWithoutContext.propTypes = __assign({ delay: PropTypes.number, ignoreCase: PropTypes.bool, iconClassName: PropTypes.string, svgIcon: kendo_react_common_1.svgIconPropType, defaultItem: PropTypes.any, valueRender: PropTypes.func, valueMap: PropTypes.func, validationMessage: PropTypes.string, required: PropTypes.bool, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string, ariaLabel: PropTypes.string, leftRightKeysNavigation: PropTypes.bool, title: PropTypes.string, groupField: PropTypes.string, list: PropTypes.any }, DropDownBase_1.default.propTypes);
|
|
678
723
|
/**
|
|
679
724
|
* @hidden
|
|
680
725
|
*/
|
|
681
|
-
DropDownListWithoutContext.defaultProps = __assign(__assign({ delay: 500, tabIndex: 0, ignoreCase: true }, DropDownBase_1.default.defaultProps), { required: false, size: 'medium', rounded: 'medium', fillMode: 'solid' });
|
|
726
|
+
DropDownListWithoutContext.defaultProps = __assign(__assign({ delay: 500, tabIndex: 0, ignoreCase: true }, DropDownBase_1.default.defaultProps), { required: false, size: 'medium', rounded: 'medium', fillMode: 'solid', groupMode: 'modern' });
|
|
682
727
|
return DropDownListWithoutContext;
|
|
683
728
|
}(React.Component));
|
|
684
729
|
exports.DropDownListWithoutContext = DropDownListWithoutContext;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { DropDownList } from './DropDownList';
|
|
3
3
|
import { FilterChangeEvent, ChangeEvent, OpenEvent, CloseEvent, FocusEvent, BlurEvent, PageChangeEvent } from './../common/events';
|
|
4
4
|
import { VirtualizationSettings, DropDownsPopupSettings } from '../common/settings';
|
|
5
|
+
import { ListGroupItemProps } from '../common/ListGroupItem';
|
|
6
|
+
import { GroupStickyHeaderProps } from '../common/GroupStickyHeader';
|
|
5
7
|
import { ListItemProps } from '../common/ListItem';
|
|
6
8
|
import { FormComponentProps, SVGIcon } from '@progress/kendo-react-common';
|
|
7
9
|
/**
|
|
@@ -297,4 +299,24 @@ export interface DropDownListProps extends FormComponentProps {
|
|
|
297
299
|
* Specifies the text that is rendered as title in the adaptive popup.
|
|
298
300
|
*/
|
|
299
301
|
adaptiveTitle?: string;
|
|
302
|
+
/**
|
|
303
|
+
* Sets the data item field that represents the start of a group. Applicable to objects data.
|
|
304
|
+
*/
|
|
305
|
+
groupField?: string;
|
|
306
|
+
/**
|
|
307
|
+
* Fires when a DropDownList's group header item is about to be rendered. Used to override the default appearance of the group's headers.
|
|
308
|
+
*/
|
|
309
|
+
groupHeaderItemRender?: (li: React.ReactElement<HTMLLIElement>, itemProps: ListGroupItemProps) => React.ReactNode;
|
|
310
|
+
/**
|
|
311
|
+
* Fires when a DropDownList's sticky group header item is about to be rendered. Used to override the default appearance of the sticky group header of the component.
|
|
312
|
+
*/
|
|
313
|
+
groupStickyHeaderItemRender?: (div: React.ReactElement<HTMLDivElement>, stickyHeaderProps: GroupStickyHeaderProps) => React.ReactNode;
|
|
314
|
+
/**
|
|
315
|
+
* @hidden
|
|
316
|
+
*/
|
|
317
|
+
list?: any;
|
|
318
|
+
/**
|
|
319
|
+
* @hidden
|
|
320
|
+
*/
|
|
321
|
+
groupMode?: string;
|
|
300
322
|
}
|
|
@@ -19,6 +19,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
19
19
|
}
|
|
20
20
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
21
|
};
|
|
22
|
+
var _this = this;
|
|
22
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
24
|
exports.DropDownTree = exports.DropDownTreePropsContext = void 0;
|
|
24
25
|
var React = require("react");
|
|
@@ -37,6 +38,9 @@ var kendo_react_labels_1 = require("@progress/kendo-react-labels");
|
|
|
37
38
|
var ListFilter_1 = require("../common/ListFilter");
|
|
38
39
|
var kendo_react_buttons_1 = require("@progress/kendo-react-buttons");
|
|
39
40
|
var kendo_svg_icons_1 = require("@progress/kendo-svg-icons");
|
|
41
|
+
var AdaptiveMode_1 = require("../common/AdaptiveMode");
|
|
42
|
+
var kendo_react_layout_1 = require("@progress/kendo-react-layout");
|
|
43
|
+
var constants_1 = require("../common/constants");
|
|
40
44
|
var sizeMap = kendo_react_common_1.kendoThemeMaps.sizeMap, roundedMap = kendo_react_common_1.kendoThemeMaps.roundedMap;
|
|
41
45
|
var VALIDATION_MESSAGE = 'Please select a value from the list!';
|
|
42
46
|
var ValueHolder = function (props) {
|
|
@@ -91,6 +95,7 @@ exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
|
91
95
|
var target = React.useRef(null);
|
|
92
96
|
var elementRef = React.useRef(null);
|
|
93
97
|
var inputRef = React.useRef(null);
|
|
98
|
+
var adaptiveInputRef = React.useRef(null);
|
|
94
99
|
var selectRef = React.useRef(null);
|
|
95
100
|
var treeViewRef = React.useRef(null);
|
|
96
101
|
var skipFocusRef = React.useRef(false);
|
|
@@ -116,6 +121,8 @@ exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
|
116
121
|
var isOpen = opened !== undefined ? opened : open;
|
|
117
122
|
var _l = React.useState(false), focused = _l[0], setFocused = _l[1];
|
|
118
123
|
var _m = React.useState(''), filter = _m[0], setFilter = _m[1];
|
|
124
|
+
var _o = React.useState(), windowWidth = _o[0], setWindowWidth = _o[1];
|
|
125
|
+
var isAdaptive = !!(windowWidth && windowWidth <= constants_1.MOBILE_MEDIUM_DEVISE && props.adaptive);
|
|
119
126
|
var setValidity = React.useCallback(function () {
|
|
120
127
|
if (selectRef.current && selectRef.current.setCustomValidity) {
|
|
121
128
|
selectRef.current.setCustomValidity(validity.valid
|
|
@@ -124,6 +131,17 @@ exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
|
124
131
|
}
|
|
125
132
|
}, [validationMessage, validity]);
|
|
126
133
|
React.useEffect(setValidity);
|
|
134
|
+
React.useEffect(function () {
|
|
135
|
+
var observerResize = kendo_react_common_1.canUseDOM && window.ResizeObserver && new window.ResizeObserver(calculateMedia.bind(_this));
|
|
136
|
+
if ((document === null || document === void 0 ? void 0 : document.body) && observerResize) {
|
|
137
|
+
observerResize.observe(document.body);
|
|
138
|
+
}
|
|
139
|
+
return function () {
|
|
140
|
+
if ((document === null || document === void 0 ? void 0 : document.body) && observerResize) {
|
|
141
|
+
observerResize.disconnect();
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}, []);
|
|
127
145
|
var openPopup = React.useCallback(function (event) {
|
|
128
146
|
if (!isOpen) {
|
|
129
147
|
if (onOpen) {
|
|
@@ -143,9 +161,14 @@ exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
|
143
161
|
}
|
|
144
162
|
if (opened === undefined) {
|
|
145
163
|
setOpen(false);
|
|
164
|
+
if (isAdaptive) {
|
|
165
|
+
setTimeout(function () {
|
|
166
|
+
focusElement(adaptiveInputRef.current);
|
|
167
|
+
}, 300);
|
|
168
|
+
}
|
|
146
169
|
}
|
|
147
170
|
}
|
|
148
|
-
}, [isOpen, opened, onClose]);
|
|
171
|
+
}, [isOpen, opened, onClose, isAdaptive]);
|
|
149
172
|
var onWrapperClick = React.useCallback(function (event) {
|
|
150
173
|
if (!event.isDefaultPrevented() && target.current) {
|
|
151
174
|
setFocused(true);
|
|
@@ -261,7 +284,9 @@ exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
|
261
284
|
var focusEvent = __assign({}, ev);
|
|
262
285
|
props.onBlur.call(undefined, focusEvent);
|
|
263
286
|
}
|
|
264
|
-
|
|
287
|
+
if (!isAdaptive) {
|
|
288
|
+
closePopup(ev);
|
|
289
|
+
}
|
|
265
290
|
}
|
|
266
291
|
}, [focused, props.onBlur, isOpen, opened, onClose]);
|
|
267
292
|
var onWrapperMouseDown = React.useCallback(function () {
|
|
@@ -269,7 +294,12 @@ exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
|
269
294
|
// moving focus from treeview to dropdown triggers Focus and Blur events.
|
|
270
295
|
switchFocus(kendo_react_common_1.noop);
|
|
271
296
|
}
|
|
272
|
-
|
|
297
|
+
if (isAdaptive) {
|
|
298
|
+
setTimeout(function () {
|
|
299
|
+
focusElement(adaptiveInputRef.current);
|
|
300
|
+
}, 300);
|
|
301
|
+
}
|
|
302
|
+
}, [focused, isAdaptive]);
|
|
273
303
|
var changeValue = React.useCallback(function (event, newValue, hierarchicalIndex) {
|
|
274
304
|
if (props.onChange) {
|
|
275
305
|
var changeEvent = __assign({ value: newValue, level: hierarchicalIndex ? toLevel(hierarchicalIndex) : [] }, event);
|
|
@@ -334,6 +364,27 @@ exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
|
334
364
|
}
|
|
335
365
|
}
|
|
336
366
|
}, [props.onFilterChange, props.filter, props.textField]);
|
|
367
|
+
var renderAdaptiveListContainer = function () {
|
|
368
|
+
var mobileFilter = props.filterable ? (React.createElement(ListFilter_1.default, { value: props.filter === undefined ? filter : props.filter, inputRef: adaptiveInputRef, onChange: onFilterChange, onKeyDown: onInputKeyDown, size: size, rounded: rounded, fillMode: fillMode })) : null;
|
|
369
|
+
var actionSheetProps = {
|
|
370
|
+
adaptiveTitle: props.adaptiveTitle,
|
|
371
|
+
expand: isOpen,
|
|
372
|
+
onClose: function (event) { return closePopup(event); },
|
|
373
|
+
windowWidth: windowWidth,
|
|
374
|
+
mobileFilter: mobileFilter
|
|
375
|
+
};
|
|
376
|
+
return (React.createElement(AdaptiveMode_1.AdaptiveMode, __assign({}, actionSheetProps),
|
|
377
|
+
React.createElement(kendo_react_layout_1.ActionSheetContent, { className: '!k-overflow-hidden' },
|
|
378
|
+
React.createElement("div", { className: 'k-list-container' },
|
|
379
|
+
React.createElement("div", { className: 'k-list k-list-lg' }, data.length > 0 ? (React.createElement(kendo_react_treeview_1.TreeView, { ref: treeViewRef, tabIndex: tabIndex, data: treeViewData, focusIdField: dataItemKey, textField: props.textField, selectField: selectField, expandField: props.expandField, childrenField: subItemsField, expandIcons: true, onItemClick: onChange, onExpandChange: onExpand, size: size, item: props.item })) : (React.createElement(NoData, null, localization.toLanguageString(messages_1.nodata, messages_1.messages[messages_1.nodata]))))))));
|
|
380
|
+
};
|
|
381
|
+
var calculateMedia = React.useCallback(function (entries) {
|
|
382
|
+
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
383
|
+
var entry = entries_1[_i];
|
|
384
|
+
setWindowWidth(entry.target.clientWidth);
|
|
385
|
+
}
|
|
386
|
+
;
|
|
387
|
+
}, []);
|
|
337
388
|
var treeViewData = React.useMemo(function () {
|
|
338
389
|
return (controlled || !hasValue) ? data :
|
|
339
390
|
(0, kendo_react_common_1.mapTree)(data, subItemsField, function (item) {
|
|
@@ -346,27 +397,29 @@ exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
|
346
397
|
var localization = (0, kendo_react_intl_1.useLocalization)();
|
|
347
398
|
var isValid = !validityStyles || validity.valid;
|
|
348
399
|
var size = props.size, rounded = props.rounded, fillMode = props.fillMode;
|
|
349
|
-
var dropdowntree = (React.createElement(
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
React.createElement(
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
React.createElement(
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
React.createElement("
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
400
|
+
var dropdowntree = (React.createElement(React.Fragment, null,
|
|
401
|
+
React.createElement("span", { className: (0, kendo_react_common_1.classNames)('k-dropdowntree k-picker', props.className, (_a = {},
|
|
402
|
+
_a["k-picker-".concat(sizeMap[size] || size)] = size,
|
|
403
|
+
_a["k-rounded-".concat(roundedMap[rounded] || rounded)] = rounded,
|
|
404
|
+
_a["k-picker-".concat(fillMode)] = fillMode,
|
|
405
|
+
_a['k-focus'] = focused,
|
|
406
|
+
_a['k-invalid'] = !isValid,
|
|
407
|
+
_a['k-loading'] = props.loading,
|
|
408
|
+
_a['k-required'] = required,
|
|
409
|
+
_a['k-disabled'] = props.disabled,
|
|
410
|
+
_a)), tabIndex: tabIndex, accessKey: props.accessKey, id: id, style: label ? __assign(__assign({}, style), { width: undefined }) : style, dir: dir, ref: elementRef, onKeyDown: disabled ? undefined : onWrapperKeyDown, onMouseDown: onWrapperMouseDown, onClick: disabled ? undefined : onWrapperClick, onFocus: onFocus, onBlur: onBlur, role: "combobox", "aria-haspopup": "tree", "aria-expanded": isOpen, "aria-disabled": disabled, "aria-label": label, "aria-labelledby": props.ariaLabelledBy, "aria-describedby": props.ariaDescribedBy, "aria-required": required },
|
|
411
|
+
React.createElement("span", { className: "k-input-inner" },
|
|
412
|
+
React.createElement(ValueComponent, { item: value }, currentValueText || placeholder)),
|
|
413
|
+
props.loading && React.createElement(kendo_react_common_1.IconWrap, { className: "k-input-loading-icon", name: 'loading' }),
|
|
414
|
+
hasValue && !disabled && (React.createElement("span", { onClick: onClear, className: "k-clear-value", title: localization.toLanguageString(messages_1.clear, messages_1.messages[messages_1.clear]), role: "button", tabIndex: -1, onMouseDown: function (e) { return e.preventDefault(); } },
|
|
415
|
+
React.createElement(kendo_react_common_1.IconWrap, { name: 'x', icon: kendo_svg_icons_1.xIcon }))),
|
|
416
|
+
React.createElement(kendo_react_buttons_1.Button, { tabIndex: -1, type: "button", "aria-label": "select", className: "k-input-button", size: size, fillMode: fillMode, themeColor: "base", rounded: null, icon: "caret-alt-down", svgIcon: kendo_svg_icons_1.caretAltDownIcon }),
|
|
417
|
+
React.createElement("select", { name: name, ref: selectRef, tabIndex: -1, "aria-hidden": true, title: label, style: { opacity: 0, width: 1, border: 0, zIndex: -1, position: 'absolute', left: '50%' } },
|
|
418
|
+
React.createElement("option", { value: props.valueMap ? props.valueMap.call(undefined, value) : value })),
|
|
419
|
+
!isAdaptive && React.createElement(kendo_react_popup_1.Popup, { className: (0, kendo_react_common_1.classNames)(popupSettings.className, { 'k-rtl': dir === 'rtl' }), popupClass: (0, kendo_react_common_1.classNames)(popupSettings.popupClass, 'k-list-container', 'k-dropdowntree-popup'), style: popupStyles, animate: popupSettings.animate, anchor: elementRef.current, show: isOpen, onOpen: onPopupOpened, onClose: onPopupClosed, appendTo: popupSettings.appendTo },
|
|
420
|
+
props.filterable && (React.createElement(ListFilter_1.default, { value: props.filter === undefined ? filter : props.filter, inputRef: inputRef, onChange: onFilterChange, onKeyDown: onInputKeyDown, size: size, rounded: rounded, fillMode: fillMode })),
|
|
421
|
+
data.length > 0 ? (React.createElement(kendo_react_treeview_1.TreeView, { ref: treeViewRef, tabIndex: tabIndex, data: treeViewData, focusIdField: dataItemKey, textField: props.textField, selectField: selectField, expandField: props.expandField, childrenField: subItemsField, expandIcons: true, onItemClick: onChange, onExpandChange: onExpand, size: size, item: props.item })) : (React.createElement(NoData, null, localization.toLanguageString(messages_1.nodata, messages_1.messages[messages_1.nodata]))))),
|
|
422
|
+
isAdaptive && renderAdaptiveListContainer()));
|
|
370
423
|
return label ? (React.createElement(kendo_react_labels_1.FloatingLabel, { label: label, editorValue: currentValueText, editorPlaceholder: placeholder, editorValid: isValid, editorDisabled: disabled, editorId: id, style: { width: style ? style.width : undefined }, children: dropdowntree, dir: dir })) : dropdowntree;
|
|
371
424
|
});
|
|
372
425
|
var propTypes = {
|
|
@@ -418,7 +471,9 @@ var propTypes = {
|
|
|
418
471
|
onExpandChange: PropTypes.func,
|
|
419
472
|
item: PropTypes.func,
|
|
420
473
|
valueHolder: PropTypes.func,
|
|
421
|
-
listNoData: PropTypes.func
|
|
474
|
+
listNoData: PropTypes.func,
|
|
475
|
+
adaptiveTitle: PropTypes.string,
|
|
476
|
+
adaptive: PropTypes.bool
|
|
422
477
|
};
|
|
423
478
|
exports.DropDownTree.displayName = 'KendoReactDropDownTree';
|
|
424
479
|
exports.DropDownTree.defaultProps = defaultProps;
|
|
@@ -283,4 +283,12 @@ export interface DropDownTreeProps extends FormComponentProps {
|
|
|
283
283
|
* @default `solid`
|
|
284
284
|
*/
|
|
285
285
|
fillMode?: null | 'solid' | 'flat' | 'outline';
|
|
286
|
+
/**
|
|
287
|
+
* Providing different rendering of the popup element based on the screen dimensions.
|
|
288
|
+
*/
|
|
289
|
+
adaptive?: boolean;
|
|
290
|
+
/**
|
|
291
|
+
* Specifies the text that is rendered as title in the adaptive popup.
|
|
292
|
+
*/
|
|
293
|
+
adaptiveTitle?: string;
|
|
286
294
|
}
|
|
@@ -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;
|