@progress/kendo-react-dropdowns 6.1.1 → 7.0.0-develop.10
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/es/AutoComplete → AutoComplete}/AutoComplete.d.ts +12 -8
- package/{dist/npm/AutoComplete → AutoComplete}/AutoCompleteProps.d.ts +4 -1
- package/{dist/es/ComboBox → ComboBox}/ComboBox.d.ts +12 -8
- package/{dist/es/ComboBox → ComboBox}/ComboBoxProps.d.ts +4 -1
- package/{dist/es/DropDownList → DropDownList}/DropDownList.d.ts +9 -5
- package/{dist/es/DropDownList → DropDownList}/DropDownListProps.d.ts +4 -1
- package/{dist/es/DropDownTree → DropDownTree}/DropDownTree.d.ts +4 -0
- package/{dist/npm/DropDownTree → DropDownTree}/DropDownTreeProps.d.ts +4 -1
- package/DropDownTree/ListNoData.d.ts +10 -0
- package/DropDownTree/useDropdownWidth.d.ts +9 -0
- package/LICENSE.md +1 -1
- package/{dist/es/MultiColumnComboBox → MultiColumnComboBox}/MultiColumnComboBox.d.ts +4 -0
- package/{dist/npm/MultiSelect → MultiSelect}/MultiSelect.d.ts +9 -5
- package/{dist/es/MultiSelect → MultiSelect}/MultiSelectProps.d.ts +4 -1
- package/{dist/npm/MultiSelect → MultiSelect}/TagList.d.ts +5 -1
- package/{dist/es/MultiSelectTree → MultiSelectTree}/MultiSelectTree.d.ts +4 -0
- package/{dist/es/MultiSelectTree → MultiSelectTree}/MultiSelectTreeProps.d.ts +5 -1
- package/{dist/npm/MultiSelectTree → MultiSelectTree}/utils.d.ts +5 -1
- package/{dist/npm/common → common}/AdaptiveMode.d.ts +5 -1
- package/common/ClearButton.d.ts +18 -0
- package/{dist/npm/common → common}/DropDownBase.d.ts +5 -1
- package/{dist/es/common → common}/GroupStickyHeader.d.ts +5 -1
- package/{dist/es/common → common}/List.d.ts +8 -3
- package/common/ListContainer.d.ts +22 -0
- package/common/ListDefaultItem.d.ts +20 -0
- package/{dist/npm/common → common}/ListFilter.d.ts +4 -0
- package/{dist/npm/common → common}/ListGroupItem.d.ts +5 -1
- package/{dist/npm/common → common}/ListItem.d.ts +5 -1
- package/common/MultiColumnList.d.ts +9 -0
- package/common/Navigation.d.ts +17 -0
- package/{dist/es/common → common}/SearchBar.d.ts +5 -1
- package/{dist/npm/common → common}/VirtualScroll.d.ts +4 -1
- package/common/constants.d.ts +8 -0
- package/{dist/es/common → common}/events.d.ts +4 -1
- package/{dist/npm/common → common}/filterDescriptor.d.ts +4 -0
- package/{dist/es/common → common}/settings.d.ts +5 -2
- package/{dist/npm/common → common}/utils.d.ts +4 -0
- package/dist/cdn/js/kendo-react-dropdowns.js +5 -1
- package/index.d.ts +29 -0
- package/index.js +5 -0
- package/index.mjs +4397 -0
- package/{dist/npm/messages → messages}/index.d.ts +4 -0
- package/package-metadata.d.ts +9 -0
- package/package.json +34 -62
- package/about.md +0 -3
- package/dist/es/AutoComplete/AutoComplete.js +0 -652
- package/dist/es/AutoComplete/AutoCompleteProps.d.ts +0 -243
- package/dist/es/AutoComplete/AutoCompleteProps.js +0 -2
- package/dist/es/ComboBox/ComboBox.js +0 -915
- package/dist/es/ComboBox/ComboBoxProps.js +0 -2
- package/dist/es/DropDownList/DropDownList.js +0 -887
- package/dist/es/DropDownList/DropDownListProps.js +0 -2
- package/dist/es/DropDownTree/DropDownTree.js +0 -540
- package/dist/es/DropDownTree/DropDownTreeProps.d.ts +0 -294
- package/dist/es/DropDownTree/DropDownTreeProps.js +0 -2
- package/dist/es/DropDownTree/ListNoData.d.ts +0 -6
- package/dist/es/DropDownTree/ListNoData.js +0 -8
- package/dist/es/DropDownTree/useDropdownWidth.d.ts +0 -5
- package/dist/es/DropDownTree/useDropdownWidth.js +0 -13
- package/dist/es/MultiColumnComboBox/MultiColumnComboBox.js +0 -213
- package/dist/es/MultiSelect/MultiSelect.d.ts +0 -256
- package/dist/es/MultiSelect/MultiSelect.js +0 -1110
- package/dist/es/MultiSelect/MultiSelectProps.js +0 -2
- package/dist/es/MultiSelect/TagList.d.ts +0 -38
- package/dist/es/MultiSelect/TagList.js +0 -39
- package/dist/es/MultiSelectTree/MultiSelectTree.js +0 -619
- package/dist/es/MultiSelectTree/MultiSelectTreeProps.js +0 -2
- package/dist/es/MultiSelectTree/utils.d.ts +0 -17
- package/dist/es/MultiSelectTree/utils.js +0 -191
- package/dist/es/common/AdaptiveMode.d.ts +0 -21
- package/dist/es/common/AdaptiveMode.js +0 -45
- package/dist/es/common/ClearButton.d.ts +0 -14
- package/dist/es/common/ClearButton.js +0 -39
- package/dist/es/common/DropDownBase.d.ts +0 -175
- package/dist/es/common/DropDownBase.js +0 -297
- package/dist/es/common/GroupStickyHeader.js +0 -34
- package/dist/es/common/List.js +0 -75
- package/dist/es/common/ListContainer.d.ts +0 -18
- package/dist/es/common/ListContainer.js +0 -43
- package/dist/es/common/ListDefaultItem.d.ts +0 -16
- package/dist/es/common/ListDefaultItem.js +0 -36
- package/dist/es/common/ListFilter.d.ts +0 -19
- package/dist/es/common/ListFilter.js +0 -37
- package/dist/es/common/ListGroupItem.d.ts +0 -33
- package/dist/es/common/ListGroupItem.js +0 -33
- package/dist/es/common/ListItem.d.ts +0 -61
- package/dist/es/common/ListItem.js +0 -44
- package/dist/es/common/MultiColumnList.d.ts +0 -6
- package/dist/es/common/MultiColumnList.js +0 -22
- package/dist/es/common/Navigation.d.ts +0 -13
- package/dist/es/common/Navigation.js +0 -34
- package/dist/es/common/SearchBar.js +0 -62
- package/dist/es/common/VirtualScroll.d.ts +0 -42
- package/dist/es/common/VirtualScroll.js +0 -161
- package/dist/es/common/constants.d.ts +0 -4
- package/dist/es/common/constants.js +0 -4
- package/dist/es/common/events.js +0 -1
- package/dist/es/common/filterDescriptor.d.ts +0 -41
- package/dist/es/common/filterDescriptor.js +0 -2
- package/dist/es/common/settings.js +0 -8
- package/dist/es/common/utils.d.ts +0 -62
- package/dist/es/common/utils.js +0 -194
- package/dist/es/main.d.ts +0 -25
- package/dist/es/main.js +0 -19
- package/dist/es/messages/index.d.ts +0 -40
- package/dist/es/messages/index.js +0 -41
- package/dist/es/package-metadata.d.ts +0 -5
- package/dist/es/package-metadata.js +0 -11
- package/dist/npm/AutoComplete/AutoComplete.d.ts +0 -230
- package/dist/npm/AutoComplete/AutoComplete.js +0 -655
- package/dist/npm/AutoComplete/AutoCompleteProps.js +0 -3
- package/dist/npm/ComboBox/ComboBox.d.ts +0 -248
- package/dist/npm/ComboBox/ComboBox.js +0 -918
- package/dist/npm/ComboBox/ComboBoxProps.d.ts +0 -313
- package/dist/npm/ComboBox/ComboBoxProps.js +0 -3
- package/dist/npm/DropDownList/DropDownList.d.ts +0 -258
- package/dist/npm/DropDownList/DropDownList.js +0 -890
- package/dist/npm/DropDownList/DropDownListProps.d.ts +0 -326
- package/dist/npm/DropDownList/DropDownListProps.js +0 -3
- package/dist/npm/DropDownTree/DropDownTree.d.ts +0 -70
- package/dist/npm/DropDownTree/DropDownTree.js +0 -543
- package/dist/npm/DropDownTree/DropDownTreeProps.js +0 -3
- package/dist/npm/DropDownTree/ListNoData.d.ts +0 -6
- package/dist/npm/DropDownTree/ListNoData.js +0 -12
- package/dist/npm/DropDownTree/useDropdownWidth.d.ts +0 -5
- package/dist/npm/DropDownTree/useDropdownWidth.js +0 -17
- package/dist/npm/MultiColumnComboBox/MultiColumnComboBox.d.ts +0 -287
- package/dist/npm/MultiColumnComboBox/MultiColumnComboBox.js +0 -216
- package/dist/npm/MultiSelect/MultiSelect.js +0 -1113
- package/dist/npm/MultiSelect/MultiSelectProps.d.ts +0 -314
- package/dist/npm/MultiSelect/MultiSelectProps.js +0 -3
- package/dist/npm/MultiSelect/TagList.js +0 -41
- package/dist/npm/MultiSelectTree/MultiSelectTree.d.ts +0 -81
- package/dist/npm/MultiSelectTree/MultiSelectTree.js +0 -622
- package/dist/npm/MultiSelectTree/MultiSelectTreeProps.d.ts +0 -320
- package/dist/npm/MultiSelectTree/MultiSelectTreeProps.js +0 -3
- package/dist/npm/MultiSelectTree/utils.js +0 -196
- package/dist/npm/common/AdaptiveMode.js +0 -49
- package/dist/npm/common/ClearButton.d.ts +0 -14
- package/dist/npm/common/ClearButton.js +0 -41
- package/dist/npm/common/DropDownBase.js +0 -299
- package/dist/npm/common/GroupStickyHeader.d.ts +0 -24
- package/dist/npm/common/GroupStickyHeader.js +0 -36
- package/dist/npm/common/List.d.ts +0 -45
- package/dist/npm/common/List.js +0 -77
- package/dist/npm/common/ListContainer.d.ts +0 -18
- package/dist/npm/common/ListContainer.js +0 -45
- package/dist/npm/common/ListDefaultItem.d.ts +0 -16
- package/dist/npm/common/ListDefaultItem.js +0 -38
- package/dist/npm/common/ListFilter.js +0 -39
- package/dist/npm/common/ListGroupItem.js +0 -35
- package/dist/npm/common/ListItem.js +0 -46
- package/dist/npm/common/MultiColumnList.d.ts +0 -6
- package/dist/npm/common/MultiColumnList.js +0 -26
- package/dist/npm/common/Navigation.d.ts +0 -13
- package/dist/npm/common/Navigation.js +0 -37
- package/dist/npm/common/SearchBar.d.ts +0 -43
- package/dist/npm/common/SearchBar.js +0 -64
- package/dist/npm/common/VirtualScroll.js +0 -163
- package/dist/npm/common/constants.d.ts +0 -4
- package/dist/npm/common/constants.js +0 -7
- package/dist/npm/common/events.d.ts +0 -73
- package/dist/npm/common/events.js +0 -2
- package/dist/npm/common/filterDescriptor.js +0 -3
- package/dist/npm/common/settings.d.ts +0 -114
- package/dist/npm/common/settings.js +0 -11
- package/dist/npm/common/utils.js +0 -211
- package/dist/npm/main.d.ts +0 -25
- package/dist/npm/main.js +0 -62
- package/dist/npm/messages/index.js +0 -44
- package/dist/npm/package-metadata.d.ts +0 -5
- package/dist/npm/package-metadata.js +0 -14
- package/dist/systemjs/kendo-react-dropdowns.js +0 -1
- package/e2e-next/combobox.basic.ts +0 -24
- package/e2e-next/dropdownlist.basic.tests.ts +0 -24
- package/e2e-next/dropdowntree.basic.tests.ts +0 -24
- package/e2e-next/multicolumncombobox.basic.tests.ts +0 -24
|
@@ -1,915 +0,0 @@
|
|
|
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
|
-
var __assign = (this && this.__assign) || function () {
|
|
17
|
-
__assign = Object.assign || function(t) {
|
|
18
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
19
|
-
s = arguments[i];
|
|
20
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
21
|
-
t[p] = s[p];
|
|
22
|
-
}
|
|
23
|
-
return t;
|
|
24
|
-
};
|
|
25
|
-
return __assign.apply(this, arguments);
|
|
26
|
-
};
|
|
27
|
-
import * as React from 'react';
|
|
28
|
-
import * as PropTypes from 'prop-types';
|
|
29
|
-
import DropDownBase from '../common/DropDownBase';
|
|
30
|
-
import { guid, classNames, Keys, createPropsContext, withPropsContext, kendoThemeMaps, svgIconPropType } from '@progress/kendo-react-common';
|
|
31
|
-
import { FloatingLabel } from '@progress/kendo-react-labels';
|
|
32
|
-
import { areSame, itemIndexStartsWith, getItemIndexByText, getItemValue, isPresent, suggestValue } from '../common/utils';
|
|
33
|
-
import SearchBar from '../common/SearchBar';
|
|
34
|
-
import ListContainer from '../common/ListContainer';
|
|
35
|
-
import List from '../common/List';
|
|
36
|
-
import ListFilter from '../common/ListFilter';
|
|
37
|
-
import GroupStickyHeader from '../common/GroupStickyHeader';
|
|
38
|
-
import { validatePackage, canUseDOM, IconWrap } from '@progress/kendo-react-common';
|
|
39
|
-
import { packageMetadata } from '../package-metadata';
|
|
40
|
-
import ClearButton from '../common/ClearButton';
|
|
41
|
-
import { Button } from '@progress/kendo-react-buttons';
|
|
42
|
-
import { caretAltDownIcon, xIcon } from '@progress/kendo-svg-icons';
|
|
43
|
-
import { messages, comboArrowBtnAriaLabelExpand, comboArrowBtnAriaLabelCollapse } from './../messages';
|
|
44
|
-
import { provideLocalizationService } from '@progress/kendo-react-intl';
|
|
45
|
-
import { ActionSheet, ActionSheetContent, ActionSheetHeader } from '@progress/kendo-react-layout';
|
|
46
|
-
import { MOBILE_SMALL_DEVISE, MOBILE_MEDIUM_DEVISE } from '../common/constants';
|
|
47
|
-
var VALIDATION_MESSAGE = 'Please enter a valid value!';
|
|
48
|
-
var sizeMap = kendoThemeMaps.sizeMap, roundedMap = kendoThemeMaps.roundedMap;
|
|
49
|
-
/** @hidden */
|
|
50
|
-
var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
51
|
-
__extends(ComboBoxWithoutContext, _super);
|
|
52
|
-
function ComboBoxWithoutContext(props) {
|
|
53
|
-
var _this = _super.call(this, props) || this;
|
|
54
|
-
/** @hidden */
|
|
55
|
-
_this.state = {};
|
|
56
|
-
_this.base = new DropDownBase(_this);
|
|
57
|
-
_this._element = null;
|
|
58
|
-
_this._inputId = guid();
|
|
59
|
-
_this._suggested = '';
|
|
60
|
-
_this._skipBlur = false;
|
|
61
|
-
_this._input = null;
|
|
62
|
-
_this._adaptiveFilterInput = null;
|
|
63
|
-
_this.itemHeight = 0;
|
|
64
|
-
/** @hidden */
|
|
65
|
-
_this.focus = function () {
|
|
66
|
-
if (_this._input) {
|
|
67
|
-
_this._input.focus();
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
/** @hidden */
|
|
71
|
-
_this.handleItemSelect = function (index, state) {
|
|
72
|
-
var _a = _this.props, _b = _a.data, data = _b === void 0 ? [] : _b, virtual = _a.virtual, dataItemKey = _a.dataItemKey;
|
|
73
|
-
var skip = virtual ? virtual.skip : 0;
|
|
74
|
-
var item = data[index - skip];
|
|
75
|
-
var newSelected = !areSame(item, _this.value, dataItemKey);
|
|
76
|
-
_this.triggerOnChange(item, state);
|
|
77
|
-
if (_this.state.text !== undefined) {
|
|
78
|
-
state.data.text = undefined;
|
|
79
|
-
}
|
|
80
|
-
if (newSelected) {
|
|
81
|
-
_this.base.triggerPageChangeCornerItems(item, state);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
_this.onPopupOpened = function () {
|
|
85
|
-
setTimeout(function () {
|
|
86
|
-
if (_this.mobileMode && _this._adaptiveFilterInput) {
|
|
87
|
-
_this._skipBlur = true;
|
|
88
|
-
_this._adaptiveFilterInput.focus();
|
|
89
|
-
_this._skipBlur = false;
|
|
90
|
-
}
|
|
91
|
-
}, 300);
|
|
92
|
-
};
|
|
93
|
-
_this.componentRef = function (element) {
|
|
94
|
-
_this._element = element;
|
|
95
|
-
_this.base.wrapper = element;
|
|
96
|
-
};
|
|
97
|
-
_this.toggleBtnClick = function (event) {
|
|
98
|
-
var _a = _this.props, _b = _a.data, data = _b === void 0 ? [] : _b, skipDisabledItems = _a.skipDisabledItems, textField = _a.textField;
|
|
99
|
-
var focusedIndex = _this.getFocusedIndex();
|
|
100
|
-
var isCurrentValueDisabled = _this.getCurrentValueDisabledStatus(textField, data, focusedIndex);
|
|
101
|
-
var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
|
|
102
|
-
var state = _this.base.initState();
|
|
103
|
-
state.syntheticEvent = event;
|
|
104
|
-
if (!skipDisabledItems && textField && isCurrentValueDisabled) {
|
|
105
|
-
_this.clearValueOnToggleBtnClick(event);
|
|
106
|
-
}
|
|
107
|
-
_this.base.togglePopup(state);
|
|
108
|
-
if (!opened && _this.mobileMode) {
|
|
109
|
-
var mobileText = _this.props.adaptiveFilter !== undefined ? _this.props.adaptiveFilter : _this.state.text || null;
|
|
110
|
-
_this.base.filterChanged(mobileText, state);
|
|
111
|
-
}
|
|
112
|
-
_this.applyState(state);
|
|
113
|
-
};
|
|
114
|
-
_this.renderMobileListFilter = function () {
|
|
115
|
-
var mobileText = _this.props.adaptiveFilter !== undefined ? _this.props.adaptiveFilter : _this.state.text;
|
|
116
|
-
var selectedItemText = getItemValue(_this.value, _this.props.textField);
|
|
117
|
-
var mobileInputText = isPresent(mobileText) ? mobileText : selectedItemText;
|
|
118
|
-
return (React.createElement(ListFilter, { value: mobileInputText, ref: function (filter) { return _this._adaptiveFilterInput = filter && filter.element; }, onChange: _this.handleMobileFilterChange, onKeyDown: _this.onInputKeyDown, size: _this.props.size, rounded: _this.props.rounded, fillMode: _this.props.fillMode }));
|
|
119
|
-
};
|
|
120
|
-
_this.handleMobileFilterChange = function (event) {
|
|
121
|
-
var state = _this.base.initState();
|
|
122
|
-
state.syntheticEvent = event.syntheticEvent;
|
|
123
|
-
state.data.text = event.target.value;
|
|
124
|
-
_this.base.filterChanged(event.target.value, state);
|
|
125
|
-
_this.applyState(state);
|
|
126
|
-
};
|
|
127
|
-
_this.onScroll = function (event) {
|
|
128
|
-
var _a = _this.base, vs = _a.vs, list = _a.list;
|
|
129
|
-
vs.scrollHandler(event);
|
|
130
|
-
var groupField = _this.props.groupField;
|
|
131
|
-
var _b = _this.props.data, data = _b === void 0 ? [] : _b;
|
|
132
|
-
if (!groupField || !data.length) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
var itemHeight = _this.itemHeight =
|
|
136
|
-
_this.itemHeight || (vs.enabled ? vs.itemHeight : (list ? list.children[0].offsetHeight : 0));
|
|
137
|
-
var target = event.target;
|
|
138
|
-
var scrollTop = target.scrollTop - (vs.skip * itemHeight);
|
|
139
|
-
if (_this.props.groupMode === 'modern') {
|
|
140
|
-
data = _this.base.getGroupedDataModernMode(data, groupField);
|
|
141
|
-
}
|
|
142
|
-
var group = data[0][groupField];
|
|
143
|
-
for (var i = 1; i < data.length; i++) {
|
|
144
|
-
if (itemHeight * i > scrollTop) {
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
if (data[i] && data[i][groupField]) {
|
|
148
|
-
group = data[i][groupField];
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
if (group !== _this.state.group) {
|
|
152
|
-
_this.setState({
|
|
153
|
-
group: group
|
|
154
|
-
});
|
|
155
|
-
if (_this.props.onGroupScroll) {
|
|
156
|
-
_this.props.onGroupScroll.call(undefined, { group: group });
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
_this.handleItemClick = function (index, event) {
|
|
161
|
-
_this.base.handleItemClick(index, event);
|
|
162
|
-
_this._valueDuringOnChange = undefined;
|
|
163
|
-
};
|
|
164
|
-
_this.handleBlur = function (event) {
|
|
165
|
-
if (_this.state.focused && !_this._skipBlur) {
|
|
166
|
-
var state = _this.base.initState();
|
|
167
|
-
var _a = _this.props, textField = _a.textField, _b = _a.data, data = _b === void 0 ? [] : _b;
|
|
168
|
-
var focusedIndex = _this.getFocusedIndex();
|
|
169
|
-
var isCustomValue = focusedIndex === -1;
|
|
170
|
-
var isCurrentValueDisabled = !isCustomValue && _this.getCurrentValueDisabledStatus(textField, data, focusedIndex);
|
|
171
|
-
state.data.focused = false;
|
|
172
|
-
state.events.push({ type: 'onBlur' });
|
|
173
|
-
state.syntheticEvent = event;
|
|
174
|
-
if (textField && isCurrentValueDisabled) {
|
|
175
|
-
_this.clearValueOnBlur(event);
|
|
176
|
-
}
|
|
177
|
-
_this.applyValueOnRejectSuggestions(event.currentTarget.value, state);
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
_this.onInputClick = function (event) {
|
|
181
|
-
var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
|
|
182
|
-
var mobileText = _this.props.adaptiveFilter !== undefined ? _this.props.adaptiveFilter : _this.state.text || null;
|
|
183
|
-
if (!opened && _this.mobileMode) {
|
|
184
|
-
var state = _this.base.initState();
|
|
185
|
-
state.syntheticEvent = event;
|
|
186
|
-
_this.base.togglePopup(state);
|
|
187
|
-
_this.base.filterChanged(mobileText, state);
|
|
188
|
-
_this.applyState(state);
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
_this.onInputKeyDown = function (event) {
|
|
192
|
-
var _a = _this.props, _b = _a.data, data = _b === void 0 ? [] : _b, skipDisabledItems = _a.skipDisabledItems, textField = _a.textField, dataItemKey = _a.dataItemKey, groupField = _a.groupField;
|
|
193
|
-
var value = _this.value;
|
|
194
|
-
var selectedIndex = Math.max(0, data.findIndex(function (i) { return areSame(i, value, dataItemKey); }));
|
|
195
|
-
var keyCode = event.keyCode;
|
|
196
|
-
var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
|
|
197
|
-
var state = _this.base.initState();
|
|
198
|
-
state.syntheticEvent = event;
|
|
199
|
-
if (!event.altKey && (keyCode === Keys.up || keyCode === Keys.down)) {
|
|
200
|
-
event.preventDefault();
|
|
201
|
-
if (groupField !== '' && textField) {
|
|
202
|
-
if (!_this.props.skipDisabledItems && opened) {
|
|
203
|
-
_this.onNavigate(state, keyCode);
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
var newIndex = 0;
|
|
207
|
-
if (keyCode === Keys.down || keyCode === Keys.right) {
|
|
208
|
-
var tempnewIndex_1 = data.slice(selectedIndex + 1).find(function (i) { return !i.disabled && i[textField]; });
|
|
209
|
-
newIndex = tempnewIndex_1 && data.findIndex(function (el) { return el[textField] === tempnewIndex_1[textField]; });
|
|
210
|
-
}
|
|
211
|
-
else if (keyCode === Keys.up || keyCode === Keys.left) {
|
|
212
|
-
var dataToSearch = void 0;
|
|
213
|
-
if (selectedIndex === 0) {
|
|
214
|
-
dataToSearch = data;
|
|
215
|
-
newIndex = data.findIndex(function (i) { return !i.disabled && i[textField]; });
|
|
216
|
-
}
|
|
217
|
-
else {
|
|
218
|
-
dataToSearch = data.slice(0, selectedIndex);
|
|
219
|
-
var tempnewIndex_2 = dataToSearch.pop();
|
|
220
|
-
while (tempnewIndex_2 && tempnewIndex_2.disabled) {
|
|
221
|
-
tempnewIndex_2 = dataToSearch.pop();
|
|
222
|
-
}
|
|
223
|
-
newIndex = tempnewIndex_2 && data.findIndex(function (el) { return el[textField] === tempnewIndex_2[textField]; });
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
if (newIndex !== undefined) {
|
|
227
|
-
var skipItems = newIndex - selectedIndex;
|
|
228
|
-
_this.onNavigate(state, keyCode, skipItems);
|
|
229
|
-
}
|
|
230
|
-
else if (newIndex === undefined && data.findIndex(function (el) { return el[textField] === value[textField]; }) === data.length - 1) {
|
|
231
|
-
_this.onNavigate(state, keyCode);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
else if (!_this.props.skipDisabledItems && opened) {
|
|
236
|
-
_this.onNavigate(state, keyCode);
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
239
|
-
var newIndex = null;
|
|
240
|
-
if (keyCode === Keys.down || keyCode === Keys.right) {
|
|
241
|
-
newIndex = data.slice(selectedIndex + 1).find(function (i) { return !i.disabled; });
|
|
242
|
-
}
|
|
243
|
-
else if (keyCode === Keys.up || keyCode === Keys.left) {
|
|
244
|
-
var dataTest = data.slice(0, selectedIndex);
|
|
245
|
-
newIndex = dataTest.pop();
|
|
246
|
-
while (newIndex && newIndex.disabled) {
|
|
247
|
-
newIndex = dataTest.pop();
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
if (newIndex) {
|
|
251
|
-
var skipItems = newIndex.id - selectedIndex - 1;
|
|
252
|
-
_this.onNavigate(state, keyCode, skipItems);
|
|
253
|
-
}
|
|
254
|
-
else {
|
|
255
|
-
_this.onNavigate(state, keyCode);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
_this.applyState(state);
|
|
259
|
-
}
|
|
260
|
-
var togglePopup = function () {
|
|
261
|
-
event.preventDefault();
|
|
262
|
-
_this.base.togglePopup(state);
|
|
263
|
-
_this.applyState(state);
|
|
264
|
-
};
|
|
265
|
-
var focusedIndex = _this.getFocusedIndex();
|
|
266
|
-
var isCustomValue = focusedIndex === -1;
|
|
267
|
-
var isCurrentValueDisabled = !isCustomValue && _this.getCurrentValueDisabledStatus(textField, data, focusedIndex);
|
|
268
|
-
if (opened) {
|
|
269
|
-
if (keyCode === Keys.pageUp) {
|
|
270
|
-
_this.base.scrollPopupByPageSize(-1);
|
|
271
|
-
}
|
|
272
|
-
else if (keyCode === Keys.pageDown) {
|
|
273
|
-
_this.base.scrollPopupByPageSize(1);
|
|
274
|
-
}
|
|
275
|
-
else if (event.altKey && keyCode === Keys.up) {
|
|
276
|
-
togglePopup();
|
|
277
|
-
}
|
|
278
|
-
else if (keyCode === Keys.enter) {
|
|
279
|
-
event.preventDefault();
|
|
280
|
-
var currentValueText = textField && !isCustomValue && event.currentTarget.value ? data[focusedIndex][textField] : undefined;
|
|
281
|
-
if (currentValueText) {
|
|
282
|
-
if (!skipDisabledItems && textField && isCurrentValueDisabled) {
|
|
283
|
-
_this.clearValueOnEnterOrEsc(event);
|
|
284
|
-
}
|
|
285
|
-
else if (!isCurrentValueDisabled) {
|
|
286
|
-
_this.applyValueOnEnter(event.currentTarget.value, state);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
else {
|
|
290
|
-
_this.applyValueOnEnter(event.currentTarget.value, state);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
else if (keyCode === Keys.esc) {
|
|
294
|
-
if (!skipDisabledItems && textField && isCurrentValueDisabled) {
|
|
295
|
-
_this.clearValueOnEnterOrEsc(event);
|
|
296
|
-
}
|
|
297
|
-
_this.applyValueOnRejectSuggestions(event.currentTarget.value, state);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
else if (!opened && keyCode === Keys.esc) {
|
|
301
|
-
_this.clearValueOnEnterOrEsc(event);
|
|
302
|
-
}
|
|
303
|
-
else if (event.altKey && keyCode === Keys.down) {
|
|
304
|
-
togglePopup();
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
_this.inputOnChange = function (event) {
|
|
308
|
-
var state = _this.base.initState();
|
|
309
|
-
state.syntheticEvent = event;
|
|
310
|
-
var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
|
|
311
|
-
var input = event.currentTarget;
|
|
312
|
-
var value = input.value;
|
|
313
|
-
if (_this.props.suggest) {
|
|
314
|
-
var selectionAtEnd = input.selectionEnd === value.length;
|
|
315
|
-
var prevText = _this.props.filter !== undefined ? _this.props.filter : _this.state.text;
|
|
316
|
-
if (!isPresent(prevText)) {
|
|
317
|
-
prevText = getItemValue(_this.value, _this.props.textField) || '';
|
|
318
|
-
}
|
|
319
|
-
var deletedSuggestion = prevText && prevText === value;
|
|
320
|
-
var deleting = prevText && prevText.length > value.length;
|
|
321
|
-
if (deletedSuggestion || deleting || !selectionAtEnd) {
|
|
322
|
-
_this._suggested = '';
|
|
323
|
-
}
|
|
324
|
-
else {
|
|
325
|
-
_this.suggestValue(value);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
if (_this.props.filter === undefined) {
|
|
329
|
-
state.data.text = value;
|
|
330
|
-
}
|
|
331
|
-
if (_this.state.focusedItem !== undefined) {
|
|
332
|
-
state.data.focusedItem = undefined;
|
|
333
|
-
}
|
|
334
|
-
if (!opened) {
|
|
335
|
-
_this.base.togglePopup(state);
|
|
336
|
-
}
|
|
337
|
-
_this.base.filterChanged(value, state);
|
|
338
|
-
_this.applyState(state);
|
|
339
|
-
_this.setState({ group: undefined });
|
|
340
|
-
};
|
|
341
|
-
_this.clearButtonClick = function (event) {
|
|
342
|
-
var state = _this.base.initState();
|
|
343
|
-
state.syntheticEvent = event;
|
|
344
|
-
event.stopPropagation();
|
|
345
|
-
_this.clearValue();
|
|
346
|
-
};
|
|
347
|
-
_this.clearValueOnEnterOrEsc = function (event) {
|
|
348
|
-
var state = _this.base.initState();
|
|
349
|
-
state.syntheticEvent = event;
|
|
350
|
-
event.stopPropagation();
|
|
351
|
-
_this.clearValue();
|
|
352
|
-
};
|
|
353
|
-
_this.clearValueOnBlur = function (event) {
|
|
354
|
-
var state = _this.base.initState();
|
|
355
|
-
state.syntheticEvent = event;
|
|
356
|
-
event.stopPropagation();
|
|
357
|
-
_this.clearValue();
|
|
358
|
-
};
|
|
359
|
-
_this.clearValueOnToggleBtnClick = function (event) {
|
|
360
|
-
var state = _this.base.initState();
|
|
361
|
-
state.syntheticEvent = event;
|
|
362
|
-
event.stopPropagation();
|
|
363
|
-
_this.clearValue();
|
|
364
|
-
};
|
|
365
|
-
_this.setValidity = function () {
|
|
366
|
-
if (_this._input && _this._input.setCustomValidity) {
|
|
367
|
-
_this._input.setCustomValidity(_this.validity.valid
|
|
368
|
-
? ''
|
|
369
|
-
: _this.props.validationMessage || VALIDATION_MESSAGE);
|
|
370
|
-
}
|
|
371
|
-
};
|
|
372
|
-
validatePackage(packageMetadata);
|
|
373
|
-
return _this;
|
|
374
|
-
}
|
|
375
|
-
Object.defineProperty(ComboBoxWithoutContext.prototype, "document", {
|
|
376
|
-
get: function () {
|
|
377
|
-
if (!canUseDOM) {
|
|
378
|
-
return;
|
|
379
|
-
}
|
|
380
|
-
// useful only for user actions
|
|
381
|
-
return (this.element && this.element.ownerDocument) || document;
|
|
382
|
-
},
|
|
383
|
-
enumerable: false,
|
|
384
|
-
configurable: true
|
|
385
|
-
});
|
|
386
|
-
Object.defineProperty(ComboBoxWithoutContext.prototype, "element", {
|
|
387
|
-
/** @hidden */
|
|
388
|
-
get: function () {
|
|
389
|
-
return this._element;
|
|
390
|
-
},
|
|
391
|
-
enumerable: false,
|
|
392
|
-
configurable: true
|
|
393
|
-
});
|
|
394
|
-
Object.defineProperty(ComboBoxWithoutContext.prototype, "mobileMode", {
|
|
395
|
-
/**
|
|
396
|
-
* The mobile mode of the ComboBox.
|
|
397
|
-
*/
|
|
398
|
-
get: function () {
|
|
399
|
-
var isAdaptive = this.state.windowWidth && this.state.windowWidth <= MOBILE_MEDIUM_DEVISE && this.props.adaptive;
|
|
400
|
-
return !!isAdaptive;
|
|
401
|
-
},
|
|
402
|
-
enumerable: false,
|
|
403
|
-
configurable: true
|
|
404
|
-
});
|
|
405
|
-
Object.defineProperty(ComboBoxWithoutContext.prototype, "value", {
|
|
406
|
-
/**
|
|
407
|
-
* The value of the ComboBox.
|
|
408
|
-
*/
|
|
409
|
-
get: function () {
|
|
410
|
-
if (this._valueDuringOnChange !== undefined) {
|
|
411
|
-
return this._valueDuringOnChange;
|
|
412
|
-
}
|
|
413
|
-
else if (this.props.value !== undefined) {
|
|
414
|
-
return this.props.value;
|
|
415
|
-
}
|
|
416
|
-
else if (this.state.value !== undefined) {
|
|
417
|
-
return this.state.value;
|
|
418
|
-
}
|
|
419
|
-
else if (this.props.defaultValue !== undefined) {
|
|
420
|
-
return this.props.defaultValue;
|
|
421
|
-
}
|
|
422
|
-
return undefined;
|
|
423
|
-
},
|
|
424
|
-
enumerable: false,
|
|
425
|
-
configurable: true
|
|
426
|
-
});
|
|
427
|
-
Object.defineProperty(ComboBoxWithoutContext.prototype, "index", {
|
|
428
|
-
/**
|
|
429
|
-
* The index of the selected item.
|
|
430
|
-
*/
|
|
431
|
-
get: function () {
|
|
432
|
-
var _a = this.props, _b = _a.data, data = _b === void 0 ? [] : _b, dataItemKey = _a.dataItemKey;
|
|
433
|
-
var value = this.value;
|
|
434
|
-
// TO DO: deprecate it!
|
|
435
|
-
return data.findIndex(function (i) { return areSame(i, value, dataItemKey); });
|
|
436
|
-
},
|
|
437
|
-
enumerable: false,
|
|
438
|
-
configurable: true
|
|
439
|
-
});
|
|
440
|
-
Object.defineProperty(ComboBoxWithoutContext.prototype, "name", {
|
|
441
|
-
/**
|
|
442
|
-
* Gets the `name` property of the ComboBox.
|
|
443
|
-
*/
|
|
444
|
-
get: function () {
|
|
445
|
-
return this.props.name;
|
|
446
|
-
},
|
|
447
|
-
enumerable: false,
|
|
448
|
-
configurable: true
|
|
449
|
-
});
|
|
450
|
-
Object.defineProperty(ComboBoxWithoutContext.prototype, "validity", {
|
|
451
|
-
/**
|
|
452
|
-
* Represents the validity state into which the component is set.
|
|
453
|
-
*/
|
|
454
|
-
get: function () {
|
|
455
|
-
// remove the undefined check when this is fixed:
|
|
456
|
-
// https://github.com/telerik/kendo-react-private/issues/252
|
|
457
|
-
var customError = this.props.validationMessage !== undefined;
|
|
458
|
-
var isValid = (!this.required
|
|
459
|
-
|| (this.value !== null && this.value !== '' && this.value !== undefined));
|
|
460
|
-
var valid = this.props.valid !== undefined ? this.props.valid : isValid;
|
|
461
|
-
return {
|
|
462
|
-
customError: customError,
|
|
463
|
-
valid: valid,
|
|
464
|
-
valueMissing: this.value === null
|
|
465
|
-
};
|
|
466
|
-
},
|
|
467
|
-
enumerable: false,
|
|
468
|
-
configurable: true
|
|
469
|
-
});
|
|
470
|
-
Object.defineProperty(ComboBoxWithoutContext.prototype, "validityStyles", {
|
|
471
|
-
get: function () {
|
|
472
|
-
return this.props.validityStyles !== undefined
|
|
473
|
-
? this.props.validityStyles
|
|
474
|
-
: ComboBoxWithoutContext.defaultProps.validityStyles;
|
|
475
|
-
},
|
|
476
|
-
enumerable: false,
|
|
477
|
-
configurable: true
|
|
478
|
-
});
|
|
479
|
-
Object.defineProperty(ComboBoxWithoutContext.prototype, "required", {
|
|
480
|
-
/** @hidden */
|
|
481
|
-
get: function () {
|
|
482
|
-
return this.props.required !== undefined
|
|
483
|
-
? this.props.required
|
|
484
|
-
: ComboBoxWithoutContext.defaultProps.required;
|
|
485
|
-
},
|
|
486
|
-
enumerable: false,
|
|
487
|
-
configurable: true
|
|
488
|
-
});
|
|
489
|
-
/** @hidden */
|
|
490
|
-
ComboBoxWithoutContext.prototype.componentDidUpdate = function (prevProps, prevState) {
|
|
491
|
-
var _a;
|
|
492
|
-
var _b = this.props, dataItemKey = _b.dataItemKey, virtual = _b.virtual, _c = _b.groupField, groupField = _c === void 0 ? '' : _c, _d = _b.data, data = _d === void 0 ? [] : _d, textField = _b.textField;
|
|
493
|
-
var prevTotal = prevProps.virtual ? prevProps.virtual.total : 0;
|
|
494
|
-
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
495
|
-
var prevOpened = prevProps.opened !== undefined ? prevProps.opened : prevState.opened;
|
|
496
|
-
var opening = !prevOpened && opened;
|
|
497
|
-
var selectedItem = this.value;
|
|
498
|
-
this._valueOnDidUpdate = selectedItem;
|
|
499
|
-
if (virtual && virtual.total !== prevTotal) {
|
|
500
|
-
this.base.vs.calcScrollElementHeight();
|
|
501
|
-
this.base.vs.reset();
|
|
502
|
-
}
|
|
503
|
-
else {
|
|
504
|
-
var prevSelectedItem = prevProps.value !== undefined ? prevProps.value : prevState.value;
|
|
505
|
-
var selectedItemIndex = data.findIndex(function (i) { return areSame(i, selectedItem, dataItemKey); });
|
|
506
|
-
// Needed to calculate the proper item index when in 'modern' grouping mode
|
|
507
|
-
if (this.props.groupMode === 'modern' && textField && selectedItem) {
|
|
508
|
-
selectedItemIndex = (_a = this.base.getGroupedDataModernMode(data, groupField)) === null || _a === void 0 ? void 0 : _a.map(function (el) { return el[textField]; }).indexOf(selectedItem[textField]);
|
|
509
|
-
}
|
|
510
|
-
var selectedItemChanged = !areSame(prevSelectedItem, selectedItem, dataItemKey);
|
|
511
|
-
if (opening && virtual) {
|
|
512
|
-
this.base.scrollToVirtualItem(virtual, selectedItemIndex);
|
|
513
|
-
}
|
|
514
|
-
else if (opening && !virtual) {
|
|
515
|
-
this.onPopupOpened();
|
|
516
|
-
// Resets the sticky header group value for scenarios with open/close of component's popup
|
|
517
|
-
if (data && data.length !== 0) {
|
|
518
|
-
this.base.resetGroupStickyHeader(data[0][groupField], this);
|
|
519
|
-
}
|
|
520
|
-
this.base.scrollToItem(selectedItemIndex);
|
|
521
|
-
}
|
|
522
|
-
else if (opened && prevOpened && selectedItem && selectedItemChanged) {
|
|
523
|
-
this.base.scrollToItem(selectedItemIndex);
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
if (opening && this._input) {
|
|
527
|
-
this._input.focus();
|
|
528
|
-
}
|
|
529
|
-
this.setValidity();
|
|
530
|
-
};
|
|
531
|
-
/** @hidden */
|
|
532
|
-
ComboBoxWithoutContext.prototype.componentDidMount = function () {
|
|
533
|
-
var _a;
|
|
534
|
-
this.observerResize = canUseDOM && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this));
|
|
535
|
-
this.base.didMount();
|
|
536
|
-
this.setValidity();
|
|
537
|
-
if (((_a = this.document) === null || _a === void 0 ? void 0 : _a.body) && this.observerResize) {
|
|
538
|
-
this.observerResize.observe(this.document.body);
|
|
539
|
-
}
|
|
540
|
-
};
|
|
541
|
-
/** @hidden */
|
|
542
|
-
ComboBoxWithoutContext.prototype.componentWillUnmount = function () {
|
|
543
|
-
var _a;
|
|
544
|
-
if (((_a = this.document) === null || _a === void 0 ? void 0 : _a.body) && this.observerResize) {
|
|
545
|
-
this.observerResize.disconnect();
|
|
546
|
-
}
|
|
547
|
-
};
|
|
548
|
-
/** @hidden */
|
|
549
|
-
ComboBoxWithoutContext.prototype.render = function () {
|
|
550
|
-
var _a;
|
|
551
|
-
var btnAriaLabelExpand = provideLocalizationService(this).toLanguageString(comboArrowBtnAriaLabelExpand, messages[comboArrowBtnAriaLabelExpand]);
|
|
552
|
-
var btnAriaLabelCollapse = provideLocalizationService(this).toLanguageString(comboArrowBtnAriaLabelCollapse, messages[comboArrowBtnAriaLabelCollapse]);
|
|
553
|
-
var _b = this.props, dir = _b.dir, disabled = _b.disabled, _c = _b.clearButton, clearButton = _c === void 0 ? ComboBoxWithoutContext.defaultProps.clearButton : _c, label = _b.label, textField = _b.textField, adaptive = _b.adaptive, className = _b.className, style = _b.style, loading = _b.loading, iconClassName = _b.iconClassName, virtual = _b.virtual, size = _b.size, rounded = _b.rounded, fillMode = _b.fillMode, _d = _b.opened, opened = _d === void 0 ? this.state.opened : _d, placeholder = _b.placeholder;
|
|
554
|
-
var _e = this.state.windowWidth, windowWidth = _e === void 0 ? 0 : _e;
|
|
555
|
-
var isValid = !this.validityStyles || this.validity.valid;
|
|
556
|
-
var text = this.props.filter !== undefined ? this.props.filter : this.state.text;
|
|
557
|
-
var selectedItemText = getItemValue(this.value, textField);
|
|
558
|
-
var inputText = isPresent(text) ? text : selectedItemText;
|
|
559
|
-
var renderClearButton = clearButton && (!!(inputText) || isPresent(this.value));
|
|
560
|
-
var base = this.base;
|
|
561
|
-
var vs = base.vs;
|
|
562
|
-
var id = this.props.id || this._inputId;
|
|
563
|
-
var renderAdaptive = windowWidth <= MOBILE_MEDIUM_DEVISE && adaptive;
|
|
564
|
-
vs.enabled = virtual !== undefined;
|
|
565
|
-
if (virtual !== undefined) {
|
|
566
|
-
vs.skip = virtual.skip;
|
|
567
|
-
vs.total = virtual.total;
|
|
568
|
-
vs.pageSize = virtual.pageSize;
|
|
569
|
-
}
|
|
570
|
-
var combobox = (React.createElement(React.Fragment, null,
|
|
571
|
-
React.createElement("span", { className: classNames('k-combobox k-input', (_a = {},
|
|
572
|
-
_a["k-input-".concat(sizeMap[size] || size)] = size,
|
|
573
|
-
_a["k-rounded-".concat(roundedMap[rounded] || rounded)] = rounded,
|
|
574
|
-
_a["k-input-".concat(fillMode)] = fillMode,
|
|
575
|
-
_a['k-invalid'] = !isValid,
|
|
576
|
-
_a['k-loading'] = loading,
|
|
577
|
-
_a['k-required'] = this.required,
|
|
578
|
-
_a['k-disabled'] = disabled,
|
|
579
|
-
_a), className), ref: this.componentRef, style: !label ? style : __assign(__assign({}, style), { width: undefined }), dir: dir },
|
|
580
|
-
this.renderSearchBar(inputText || '', id, placeholder),
|
|
581
|
-
renderClearButton && !loading && React.createElement(ClearButton, { onClick: this.clearButtonClick, key: "clearbutton" }),
|
|
582
|
-
loading && React.createElement(IconWrap, { className: "k-input-loading-icon", name: 'loading', key: "loading" }),
|
|
583
|
-
React.createElement(Button, { tabIndex: -1, type: "button", "aria-label": opened ? btnAriaLabelCollapse : btnAriaLabelExpand, icon: !iconClassName ? 'caret-alt-down' : undefined, svgIcon: !iconClassName ? caretAltDownIcon : this.props.svgIcon, iconClass: iconClassName, size: size, fillMode: fillMode, rounded: null, themeColor: 'base', className: "k-input-button", onClick: this.toggleBtnClick, onMouseDown: function (e) { return e.preventDefault(); } }),
|
|
584
|
-
!renderAdaptive && this.renderListContainer()),
|
|
585
|
-
renderAdaptive && this.renderAdaptiveListContainer()));
|
|
586
|
-
return label
|
|
587
|
-
? (React.createElement(FloatingLabel, { label: label, editorId: id, editorValue: inputText, editorValid: isValid, editorDisabled: disabled, style: { width: style ? style.width : undefined }, children: combobox }))
|
|
588
|
-
: combobox;
|
|
589
|
-
};
|
|
590
|
-
/** @hidden */
|
|
591
|
-
ComboBoxWithoutContext.prototype.onNavigate = function (state, keyCode, skipItems) {
|
|
592
|
-
var _a = this.props, _b = _a.data, data = _b === void 0 ? [] : _b, _c = _a.virtual, virtual = _c === void 0 ? { skip: 0 } : _c;
|
|
593
|
-
var text = this.props.filter ? this.props.filter : this.state.text;
|
|
594
|
-
var focusedIndex = this.getFocusedIndex();
|
|
595
|
-
var vs = this.base.vs;
|
|
596
|
-
var value = this.value;
|
|
597
|
-
this._suggested = '';
|
|
598
|
-
if (focusedIndex !== -1 && !isPresent(value)) {
|
|
599
|
-
this.handleItemSelect(focusedIndex, state);
|
|
600
|
-
}
|
|
601
|
-
else if (text === '') {
|
|
602
|
-
this.handleItemSelect(0, state);
|
|
603
|
-
}
|
|
604
|
-
else {
|
|
605
|
-
var currentIndex = virtual.skip + focusedIndex;
|
|
606
|
-
var newIndex = this.base.navigation.navigate({
|
|
607
|
-
keyCode: keyCode,
|
|
608
|
-
current: currentIndex,
|
|
609
|
-
max: (vs.enabled ? vs.total : data.length) - 1,
|
|
610
|
-
min: 0,
|
|
611
|
-
skipItems: skipItems ? skipItems : undefined
|
|
612
|
-
});
|
|
613
|
-
if (newIndex !== undefined) {
|
|
614
|
-
this.handleItemSelect(newIndex, state);
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
};
|
|
618
|
-
;
|
|
619
|
-
ComboBoxWithoutContext.prototype.getCurrentValueDisabledStatus = function (textField, data, focusedIndex) {
|
|
620
|
-
return textField && data && data[focusedIndex] && data[focusedIndex].disabled;
|
|
621
|
-
};
|
|
622
|
-
ComboBoxWithoutContext.prototype.applyValueOnEnter = function (value, state) {
|
|
623
|
-
var _a;
|
|
624
|
-
var _b = this.props, _c = _b.data, data = _c === void 0 ? [] : _c, textField = _b.textField, allowCustom = _b.allowCustom;
|
|
625
|
-
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
626
|
-
var currentValueText = getItemValue(this.value, textField);
|
|
627
|
-
var valueIndex = currentValueText === value ?
|
|
628
|
-
this.index : getItemIndexByText(data, value, textField);
|
|
629
|
-
var itemSelected = valueIndex !== -1;
|
|
630
|
-
var newSelected = undefined;
|
|
631
|
-
this._suggested = '';
|
|
632
|
-
if (itemSelected) { // typed text match item from list
|
|
633
|
-
newSelected = data[valueIndex];
|
|
634
|
-
}
|
|
635
|
-
else {
|
|
636
|
-
if (allowCustom) { // any custom text not in list
|
|
637
|
-
newSelected = textField !== undefined ? (_a = {}, _a[textField] = value, _a) : value;
|
|
638
|
-
}
|
|
639
|
-
else {
|
|
640
|
-
return this.selectFocusedItem(value, state);
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
this.triggerOnChange(newSelected, state);
|
|
644
|
-
if (opened) {
|
|
645
|
-
this.base.togglePopup(state);
|
|
646
|
-
}
|
|
647
|
-
if (this.props.filter === undefined && this.state.text !== undefined) {
|
|
648
|
-
state.data.text = undefined;
|
|
649
|
-
}
|
|
650
|
-
this.applyState(state);
|
|
651
|
-
};
|
|
652
|
-
ComboBoxWithoutContext.prototype.applyValueOnRejectSuggestions = function (text, state) {
|
|
653
|
-
var _a;
|
|
654
|
-
var _b = this.props, _c = _b.data, data = _c === void 0 ? [] : _c, textField = _b.textField, allowCustom = _b.allowCustom;
|
|
655
|
-
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
656
|
-
var valueItemText = getItemValue(this.value, textField);
|
|
657
|
-
var isMobileDevice = this.state.windowWidth && this.state.windowWidth <= MOBILE_MEDIUM_DEVISE;
|
|
658
|
-
this._suggested = '';
|
|
659
|
-
if (text === valueItemText || (text === '' && !isPresent(valueItemText))) {
|
|
660
|
-
if (opened && !isMobileDevice) {
|
|
661
|
-
this.base.togglePopup(state);
|
|
662
|
-
}
|
|
663
|
-
return this.applyState(state);
|
|
664
|
-
}
|
|
665
|
-
var valueIndex = getItemIndexByText(data, text, textField, true);
|
|
666
|
-
var itemSelected = valueIndex !== -1;
|
|
667
|
-
var newSelected = null;
|
|
668
|
-
if (itemSelected) {
|
|
669
|
-
newSelected = data[valueIndex];
|
|
670
|
-
}
|
|
671
|
-
else if (allowCustom) {
|
|
672
|
-
newSelected = text ? (textField ? (_a = {}, _a[textField] = text, _a) : text) : null;
|
|
673
|
-
}
|
|
674
|
-
this.triggerOnChange(newSelected, state);
|
|
675
|
-
if (this.state.text !== undefined) {
|
|
676
|
-
state.data.text = undefined;
|
|
677
|
-
this.base.filterChanged('', state);
|
|
678
|
-
}
|
|
679
|
-
if (opened && !isMobileDevice) {
|
|
680
|
-
this.base.togglePopup(state);
|
|
681
|
-
}
|
|
682
|
-
this.applyState(state);
|
|
683
|
-
};
|
|
684
|
-
ComboBoxWithoutContext.prototype.selectFocusedItem = function (text, state) {
|
|
685
|
-
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
686
|
-
var _a = this.props, _b = _a.data, data = _b === void 0 ? [] : _b, textField = _a.textField, _c = _a.virtual, virtual = _c === void 0 ? { skip: 0 } : _c, _d = _a.focusedItemIndex, focusedItemIndex = _d === void 0 ? itemIndexStartsWith : _d;
|
|
687
|
-
var skip = virtual.skip;
|
|
688
|
-
var focusedIndex = (text === '' && skip === 0) ? 0 :
|
|
689
|
-
focusedItemIndex(data, text, textField);
|
|
690
|
-
if (focusedIndex !== -1) {
|
|
691
|
-
this.handleItemSelect(focusedIndex + skip, state);
|
|
692
|
-
}
|
|
693
|
-
else {
|
|
694
|
-
this.triggerOnChange(null, state);
|
|
695
|
-
if (this.state.text !== undefined) {
|
|
696
|
-
state.data.text = undefined;
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
if (opened) {
|
|
700
|
-
this.base.togglePopup(state);
|
|
701
|
-
}
|
|
702
|
-
return this.applyState(state);
|
|
703
|
-
};
|
|
704
|
-
ComboBoxWithoutContext.prototype.renderAdaptiveListContainer = function () {
|
|
705
|
-
var _a;
|
|
706
|
-
var _this = this;
|
|
707
|
-
var _b = this.state.windowWidth, windowWidth = _b === void 0 ? 0 : _b;
|
|
708
|
-
var _c = this.props, header = _c.header, footer = _c.footer, size = _c.size, _d = _c.data, data = _d === void 0 ? [] : _d, groupField = _c.groupField, groupMode = _c.groupMode, list = _c.list, virtual = _c.virtual, adaptiveTitle = _c.adaptiveTitle, groupStickyHeaderItemRender = _c.groupStickyHeaderItemRender;
|
|
709
|
-
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
710
|
-
var group = this.state.group;
|
|
711
|
-
if (group === undefined && groupField !== undefined) {
|
|
712
|
-
group = getItemValue(data[0], groupField);
|
|
713
|
-
}
|
|
714
|
-
var actionSheetProps = {
|
|
715
|
-
navigatable: false,
|
|
716
|
-
navigatableElements: [],
|
|
717
|
-
expand: opened,
|
|
718
|
-
animation: true,
|
|
719
|
-
onClose: function (event) { return _this.toggleBtnClick(event); },
|
|
720
|
-
animationStyles: windowWidth <= MOBILE_SMALL_DEVISE ? { top: 0, width: '100%', height: '100%' } : undefined,
|
|
721
|
-
className: windowWidth <= MOBILE_SMALL_DEVISE
|
|
722
|
-
? 'k-adaptive-actionsheet k-actionsheet-fullscreen'
|
|
723
|
-
: 'k-adaptive-actionsheet k-actionsheet-bottom'
|
|
724
|
-
};
|
|
725
|
-
return (React.createElement(React.Fragment, null,
|
|
726
|
-
React.createElement(ActionSheet, __assign({}, actionSheetProps),
|
|
727
|
-
React.createElement(ActionSheetHeader, { className: 'k-text-center' },
|
|
728
|
-
React.createElement("div", { className: "k-actionsheet-titlebar-group k-hbox" },
|
|
729
|
-
React.createElement("div", { className: "k-actionsheet-title" },
|
|
730
|
-
React.createElement("div", null, adaptiveTitle)),
|
|
731
|
-
React.createElement("div", { className: "k-actionsheet-actions" },
|
|
732
|
-
React.createElement(Button, { tabIndex: 0, "aria-label": "Cancel", "aria-disabled": "false", type: "button", fillMode: "flat", onClick: this.toggleBtnClick, icon: 'x', svgIcon: xIcon }))),
|
|
733
|
-
React.createElement("div", { className: "k-actionsheet-titlebar-group k-actionsheet-filter" }, this.renderMobileListFilter())),
|
|
734
|
-
React.createElement(ActionSheetContent, { className: '!k-overflow-hidden' },
|
|
735
|
-
React.createElement("div", { className: 'k-list-container' },
|
|
736
|
-
React.createElement("div", { className: classNames((_a = {},
|
|
737
|
-
_a['k-list'] = !list,
|
|
738
|
-
_a['k-list-lg'] = true,
|
|
739
|
-
_a['k-virtual-list'] = virtual,
|
|
740
|
-
_a['k-data-table'] = list,
|
|
741
|
-
_a["k-table-".concat(sizeMap[size] || size)] = list && size,
|
|
742
|
-
_a)) },
|
|
743
|
-
header && React.createElement("div", { className: "k-table-header" }, header),
|
|
744
|
-
!list && group && data.length !== 0 && React.createElement(GroupStickyHeader, { group: group, groupMode: groupMode, render: groupStickyHeaderItemRender }),
|
|
745
|
-
this.renderList(),
|
|
746
|
-
footer && React.createElement("div", { className: "k-list-footer" }, footer)))))));
|
|
747
|
-
};
|
|
748
|
-
ComboBoxWithoutContext.prototype.renderListContainer = function () {
|
|
749
|
-
var _a, _b;
|
|
750
|
-
var base = this.base;
|
|
751
|
-
var _c = this.props, dir = _c.dir, header = _c.header, footer = _c.footer, _d = _c.data, data = _d === void 0 ? [] : _d, groupField = _c.groupField, groupMode = _c.groupMode, size = _c.size, list = _c.list, virtual = _c.virtual, groupStickyHeaderItemRender = _c.groupStickyHeaderItemRender;
|
|
752
|
-
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
753
|
-
var popupSettings = base.getPopupSettings();
|
|
754
|
-
var popupWidth = popupSettings.width !== undefined ? popupSettings.width : base.popupWidth;
|
|
755
|
-
var group = this.state.group;
|
|
756
|
-
if (group === undefined && groupField !== undefined) {
|
|
757
|
-
group = getItemValue(data[0], groupField);
|
|
758
|
-
}
|
|
759
|
-
return (React.createElement(ListContainer, { width: popupWidth, popupSettings: {
|
|
760
|
-
animate: popupSettings.animate,
|
|
761
|
-
anchor: this.element,
|
|
762
|
-
show: opened,
|
|
763
|
-
popupClass: classNames(popupSettings.popupClass, 'k-list-container', 'k-combobox-popup'),
|
|
764
|
-
className: popupSettings.className,
|
|
765
|
-
appendTo: popupSettings.appendTo
|
|
766
|
-
}, dir: dir !== undefined ? dir : this.base.dirCalculated, itemsCount: [data.length] },
|
|
767
|
-
React.createElement("div", { className: classNames((_a = {},
|
|
768
|
-
_a['k-list'] = !list,
|
|
769
|
-
_a["k-list-".concat(sizeMap[size] || size)] = !list && size,
|
|
770
|
-
_a['k-virtual-list'] = virtual,
|
|
771
|
-
_a['k-data-table'] = list,
|
|
772
|
-
_a["k-table-".concat(sizeMap[size] || size)] = list && size,
|
|
773
|
-
_a)) },
|
|
774
|
-
header && React.createElement("div", { className: "k-table-header" }, header),
|
|
775
|
-
!list && group && data.length !== 0 && React.createElement(GroupStickyHeader, { group: group, groupMode: groupMode, render: groupStickyHeaderItemRender }),
|
|
776
|
-
this.renderList(),
|
|
777
|
-
footer &&
|
|
778
|
-
React.createElement("div", { className: classNames((_b = {},
|
|
779
|
-
_b['k-list-footer'] = !this.props.footerClassName,
|
|
780
|
-
_b), this.props.footerClassName) }, footer))));
|
|
781
|
-
};
|
|
782
|
-
ComboBoxWithoutContext.prototype.renderList = function () {
|
|
783
|
-
var _a;
|
|
784
|
-
var _this = this;
|
|
785
|
-
var base = this.base;
|
|
786
|
-
var _b = this.props, textField = _b.textField, dataItemKey = _b.dataItemKey, listNoDataRender = _b.listNoDataRender, itemRender = _b.itemRender, groupHeaderItemRender = _b.groupHeaderItemRender, _c = _b.data, data = _c === void 0 ? [] : _c, _d = _b.virtual, virtual = _d === void 0 ? { skip: 0 } : _d;
|
|
787
|
-
var popupSettings = base.getPopupSettings();
|
|
788
|
-
var vs = base.vs;
|
|
789
|
-
var skip = virtual.skip;
|
|
790
|
-
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
791
|
-
var translate = "translateY(".concat(vs.translate, "px)");
|
|
792
|
-
var focusedIndex = opened ? this.getFocusedIndex() : undefined;
|
|
793
|
-
var text = this.props.filter !== undefined ? this.props.filter : this.state.text;
|
|
794
|
-
var selectedItemText = getItemValue(this.value, textField);
|
|
795
|
-
var value = isPresent(text) && text !== selectedItemText ? null : this.value;
|
|
796
|
-
var ListComponent = this.props.list || List;
|
|
797
|
-
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, groupMode: this.props.groupMode, isMultiColumn: this.props.isMultiColumn, optionsGuid: base.guid, listRef: function (list) { vs.list = _this.base.list = list; _this.itemHeight = 0; }, wrapperStyle: (this.state.windowWidth && this.state.windowWidth > MOBILE_MEDIUM_DEVISE)
|
|
798
|
-
? { maxHeight: popupSettings.height }
|
|
799
|
-
: {}, wrapperCssClass: classNames('k-list-content', (_a = {},
|
|
800
|
-
_a['k-list-scroller'] = !virtual,
|
|
801
|
-
_a)), listStyle: vs.enabled ? { transform: translate } : undefined, key: "listkey", skip: skip, onClick: this.handleItemClick, itemRender: itemRender, groupHeaderItemRender: groupHeaderItemRender, noDataRender: listNoDataRender, onMouseDown: function (e) { return e.preventDefault(); }, onScroll: this.onScroll, wrapperRef: vs.scrollerRef, scroller: this.base.renderScrollElement() }));
|
|
802
|
-
};
|
|
803
|
-
ComboBoxWithoutContext.prototype.renderSearchBar = function (text, id, placeholder) {
|
|
804
|
-
var _this = this;
|
|
805
|
-
var _a = this.props, tabIndex = _a.tabIndex, disabled = _a.disabled, _b = _a.data, data = _b === void 0 ? [] : _b, dataItemKey = _a.dataItemKey, _c = _a.virtual, virtual = _c === void 0 ? { skip: 0 } : _c;
|
|
806
|
-
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
807
|
-
var value = this.value;
|
|
808
|
-
var selectedIndex = Math.max(0, data.findIndex(function (i) { return areSame(i, value, dataItemKey); }));
|
|
809
|
-
if (this._suggested && !areSame(this._valueOnDidUpdate, value, dataItemKey)) {
|
|
810
|
-
this._suggested = '';
|
|
811
|
-
}
|
|
812
|
-
return (React.createElement(SearchBar, { id: id, readOnly: (opened && this.mobileMode), placeholder: placeholder, tabIndex: tabIndex, title: this.props.title, accessKey: this.props.accessKey, value: text + this._suggested, suggestedText: this._suggested, ref: function (el) { return _this._input = el && el.input; }, onClick: this.onInputClick, onKeyDown: this.onInputKeyDown, onChange: this.inputOnChange, onFocus: this.base.handleFocus, onBlur: this.handleBlur, disabled: disabled, expanded: opened, owns: this.base.listBoxId, activedescendant: "option-".concat(this.base.guid, "-").concat(selectedIndex + virtual.skip), role: "combobox", ariaLabelledBy: this.props.ariaLabelledBy, ariaDescribedBy: this.props.ariaDescribedBy, ariaRequired: this.required, render: this.props.valueRender }));
|
|
813
|
-
};
|
|
814
|
-
ComboBoxWithoutContext.prototype.clearValue = function () {
|
|
815
|
-
var state = this.base.initState();
|
|
816
|
-
this._suggested = '';
|
|
817
|
-
this.base.filterChanged('', state);
|
|
818
|
-
if (this.props.filter === undefined && this.state.text !== undefined) {
|
|
819
|
-
state.data.text = undefined;
|
|
820
|
-
}
|
|
821
|
-
this.triggerOnChange(null, state);
|
|
822
|
-
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
823
|
-
var isAdaptive = this.mobileMode;
|
|
824
|
-
if (opened && !isAdaptive) {
|
|
825
|
-
this.base.togglePopup(state);
|
|
826
|
-
}
|
|
827
|
-
this.applyState(state);
|
|
828
|
-
};
|
|
829
|
-
ComboBoxWithoutContext.prototype.triggerOnChange = function (item, state) {
|
|
830
|
-
var value = this.value;
|
|
831
|
-
if ((!isPresent(value) && !isPresent(item)) || areSame(value, item, this.props.dataItemKey)) {
|
|
832
|
-
return;
|
|
833
|
-
}
|
|
834
|
-
if (this.props.value === undefined) {
|
|
835
|
-
state.data.value = item;
|
|
836
|
-
}
|
|
837
|
-
this._valueDuringOnChange = item;
|
|
838
|
-
state.events.push({ type: 'onChange' });
|
|
839
|
-
};
|
|
840
|
-
ComboBoxWithoutContext.prototype.getFocusedIndex = function () {
|
|
841
|
-
var value = this.value;
|
|
842
|
-
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, _d = _a.focusedItemIndex, focusedItemIndex = _d === void 0 ? itemIndexStartsWith : _d, skipDisabledItems = _a.skipDisabledItems;
|
|
843
|
-
var text = this.props.filter ? this.props.filter : this.state.text;
|
|
844
|
-
if (isPresent(value) && text === undefined) {
|
|
845
|
-
return data.findIndex(function (i) { return areSame(i, value, dataItemKey); });
|
|
846
|
-
}
|
|
847
|
-
else if (text) {
|
|
848
|
-
return focusedItemIndex(data, text, textField);
|
|
849
|
-
}
|
|
850
|
-
else if (skipDisabledItems && textField && !text && virtual.skip === 0) {
|
|
851
|
-
return data.findIndex(function (i) { return !i.disabled && i[textField]; });
|
|
852
|
-
}
|
|
853
|
-
else {
|
|
854
|
-
return virtual.skip === 0 ? 0 : -1;
|
|
855
|
-
}
|
|
856
|
-
};
|
|
857
|
-
ComboBoxWithoutContext.prototype.suggestValue = function (value) {
|
|
858
|
-
var _a = this.props, data = _a.data, textField = _a.textField;
|
|
859
|
-
this._suggested = suggestValue(value, data, textField);
|
|
860
|
-
};
|
|
861
|
-
ComboBoxWithoutContext.prototype.applyState = function (state) {
|
|
862
|
-
this.base.applyState(state);
|
|
863
|
-
this._valueDuringOnChange = undefined;
|
|
864
|
-
};
|
|
865
|
-
ComboBoxWithoutContext.prototype.calculateMedia = function (entries) {
|
|
866
|
-
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
867
|
-
var entry = entries_1[_i];
|
|
868
|
-
this.setState({ windowWidth: entry.target.clientWidth });
|
|
869
|
-
}
|
|
870
|
-
;
|
|
871
|
-
};
|
|
872
|
-
;
|
|
873
|
-
ComboBoxWithoutContext.displayName = 'ComboBox';
|
|
874
|
-
/** @hidden */
|
|
875
|
-
ComboBoxWithoutContext.propTypes = __assign(__assign({}, DropDownBase.propTypes), { size: PropTypes.oneOf([null, 'small', 'medium', 'large']), rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']), fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline']), dataItemKey: PropTypes.string, groupField: PropTypes.string, groupMode: PropTypes.oneOf([undefined, 'classic', 'modern']), isMultiColumn: PropTypes.bool, suggest: PropTypes.bool, placeholder: PropTypes.string, title: PropTypes.string, allowCustom: PropTypes.bool, clearButton: PropTypes.bool, iconClassName: PropTypes.string, svgIcon: svgIconPropType, validationMessage: PropTypes.string, required: PropTypes.bool, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string, list: PropTypes.any, valueRender: PropTypes.func, skipDisabledItems: PropTypes.bool });
|
|
876
|
-
/** @hidden */
|
|
877
|
-
ComboBoxWithoutContext.defaultProps = __assign(__assign({}, DropDownBase.defaultProps), { size: 'medium', rounded: 'medium', fillMode: 'solid', allowCustom: false, clearButton: true, required: false, groupMode: 'modern', isMultiColumn: false, skipDisabledItems: true });
|
|
878
|
-
return ComboBoxWithoutContext;
|
|
879
|
-
}(React.Component));
|
|
880
|
-
export { ComboBoxWithoutContext };
|
|
881
|
-
/**
|
|
882
|
-
* Represents the PropsContext of the `ComboBox` component.
|
|
883
|
-
* Used for global configuration of all `ComboBox` instances.
|
|
884
|
-
*
|
|
885
|
-
* For more information, refer to the [Dropdowns Props Context]({% slug props-context_dropdowns %}) article.
|
|
886
|
-
*/
|
|
887
|
-
export var ComboBoxPropsContext = createPropsContext();
|
|
888
|
-
/* eslint-disable @typescript-eslint/no-redeclare -- intentionally naming the component the same as the type */
|
|
889
|
-
/**
|
|
890
|
-
* Represents the [KendoReact ComboBox component]({% slug overview_combobox %}).
|
|
891
|
-
*
|
|
892
|
-
* Accepts properties of type [ComboBoxProps]({% slug api_dropdowns_comboboxprops %}).
|
|
893
|
-
* Obtaining the `ref` returns an object of type [ComboBoxHandle]({% slug api_dropdowns_comboboxhandle %}).
|
|
894
|
-
*
|
|
895
|
-
* @example
|
|
896
|
-
* ```jsx
|
|
897
|
-
* class App extends React.Component {
|
|
898
|
-
* combobox = null;
|
|
899
|
-
* render() {
|
|
900
|
-
* return (
|
|
901
|
-
* <div>
|
|
902
|
-
* <ComboBox
|
|
903
|
-
* data={[ "Albania", "Andorra", "Austria", "Belarus" ]}
|
|
904
|
-
* ref={component => this.combobox = component}
|
|
905
|
-
* />
|
|
906
|
-
* <button onClick={() => alert(this.combobox.value)}>alert value</button>
|
|
907
|
-
* </div>
|
|
908
|
-
* );
|
|
909
|
-
* }
|
|
910
|
-
* }
|
|
911
|
-
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
912
|
-
* ```
|
|
913
|
-
*/
|
|
914
|
-
export var ComboBox = withPropsContext(ComboBoxPropsContext, ComboBoxWithoutContext);
|
|
915
|
-
ComboBox.displayName = 'KendoReactComboBox';
|