@progress/kendo-react-dropdowns 4.14.0 → 5.0.0
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 +7 -4
- package/dist/es/AutoComplete/AutoComplete.js +30 -19
- package/dist/es/AutoComplete/AutoCompleteProps.d.ts +37 -0
- package/dist/es/ComboBox/ComboBox.d.ts +8 -1
- package/dist/es/ComboBox/ComboBox.js +46 -33
- package/dist/es/ComboBox/ComboBoxProps.d.ts +37 -0
- package/dist/es/DropDownList/DropDownList.d.ts +6 -8
- package/dist/es/DropDownList/DropDownList.js +56 -48
- package/dist/es/DropDownList/DropDownListProps.d.ts +37 -0
- package/dist/es/DropDownTree/DropDownTree.js +44 -24
- package/dist/es/DropDownTree/DropDownTreeProps.d.ts +37 -0
- package/dist/es/MultiColumnComboBox/MultiColumnComboBox.d.ts +37 -0
- package/dist/es/MultiColumnComboBox/MultiColumnComboBox.js +23 -12
- package/dist/es/MultiSelect/MultiSelect.d.ts +8 -5
- package/dist/es/MultiSelect/MultiSelect.js +51 -32
- package/dist/es/MultiSelect/MultiSelectProps.d.ts +38 -1
- package/dist/es/MultiSelect/TagList.d.ts +2 -1
- package/dist/es/MultiSelect/TagList.js +10 -15
- package/dist/es/MultiSelectTree/MultiSelectTree.js +42 -29
- package/dist/es/MultiSelectTree/MultiSelectTreeProps.d.ts +37 -0
- package/dist/es/common/ClearButton.js +2 -1
- package/dist/es/common/DropDownBase.d.ts +2 -3
- package/dist/es/common/DropDownBase.js +2 -16
- package/dist/es/common/List.d.ts +1 -0
- package/dist/es/common/List.js +3 -2
- package/dist/es/common/ListDefaultItem.js +2 -2
- package/dist/es/common/ListFilter.d.ts +5 -0
- package/dist/es/common/ListFilter.js +12 -3
- package/dist/es/common/ListItem.js +5 -5
- package/dist/es/common/MultiColumnList.js +1 -1
- package/dist/es/common/SearchBar.d.ts +1 -4
- package/dist/es/common/SearchBar.js +2 -8
- package/dist/es/common/VirtualScroll.js +3 -2
- package/dist/es/package-metadata.js +1 -1
- package/dist/npm/AutoComplete/AutoComplete.d.ts +7 -4
- package/dist/npm/AutoComplete/AutoComplete.js +29 -18
- package/dist/npm/AutoComplete/AutoCompleteProps.d.ts +37 -0
- package/dist/npm/ComboBox/ComboBox.d.ts +8 -1
- package/dist/npm/ComboBox/ComboBox.js +45 -32
- package/dist/npm/ComboBox/ComboBoxProps.d.ts +37 -0
- package/dist/npm/DropDownList/DropDownList.d.ts +6 -8
- package/dist/npm/DropDownList/DropDownList.js +55 -47
- package/dist/npm/DropDownList/DropDownListProps.d.ts +37 -0
- package/dist/npm/DropDownTree/DropDownTree.js +43 -23
- package/dist/npm/DropDownTree/DropDownTreeProps.d.ts +37 -0
- package/dist/npm/MultiColumnComboBox/MultiColumnComboBox.d.ts +37 -0
- package/dist/npm/MultiColumnComboBox/MultiColumnComboBox.js +22 -11
- package/dist/npm/MultiSelect/MultiSelect.d.ts +8 -5
- package/dist/npm/MultiSelect/MultiSelect.js +50 -31
- package/dist/npm/MultiSelect/MultiSelectProps.d.ts +38 -1
- package/dist/npm/MultiSelect/TagList.d.ts +2 -1
- package/dist/npm/MultiSelect/TagList.js +10 -15
- package/dist/npm/MultiSelectTree/MultiSelectTree.js +40 -27
- package/dist/npm/MultiSelectTree/MultiSelectTreeProps.d.ts +37 -0
- package/dist/npm/common/ClearButton.js +2 -1
- package/dist/npm/common/DropDownBase.d.ts +2 -3
- package/dist/npm/common/DropDownBase.js +2 -16
- package/dist/npm/common/List.d.ts +1 -0
- package/dist/npm/common/List.js +3 -2
- package/dist/npm/common/ListDefaultItem.js +2 -2
- package/dist/npm/common/ListFilter.d.ts +5 -0
- package/dist/npm/common/ListFilter.js +12 -3
- package/dist/npm/common/ListItem.js +5 -5
- package/dist/npm/common/MultiColumnList.js +1 -1
- package/dist/npm/common/SearchBar.d.ts +1 -4
- package/dist/npm/common/SearchBar.js +2 -8
- package/dist/npm/common/VirtualScroll.js +3 -2
- package/dist/npm/package-metadata.js +1 -1
- package/dist/systemjs/kendo-react-dropdowns.js +1 -1
- package/package.json +19 -13
|
@@ -24,6 +24,9 @@ export declare class AutoCompleteWithoutContext extends React.Component<AutoComp
|
|
|
24
24
|
* @hidden
|
|
25
25
|
*/
|
|
26
26
|
static propTypes: {
|
|
27
|
+
size: PropTypes.Requireable<"small" | "medium" | "large">;
|
|
28
|
+
rounded: PropTypes.Requireable<"small" | "medium" | "large" | "full">;
|
|
29
|
+
fillMode: PropTypes.Requireable<"solid" | "flat" | "outline">;
|
|
27
30
|
suggest: PropTypes.Requireable<string | boolean>;
|
|
28
31
|
placeholder: PropTypes.Requireable<string>;
|
|
29
32
|
value: PropTypes.Requireable<string>;
|
|
@@ -53,11 +56,8 @@ export declare class AutoCompleteWithoutContext extends React.Component<AutoComp
|
|
|
53
56
|
}>>;
|
|
54
57
|
popupClass: PropTypes.Requireable<string>;
|
|
55
58
|
className: PropTypes.Requireable<string>;
|
|
56
|
-
appendTo: PropTypes.Requireable<
|
|
59
|
+
appendTo: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
57
60
|
width: PropTypes.Requireable<string | number>;
|
|
58
|
-
/**
|
|
59
|
-
* @hidden
|
|
60
|
-
*/
|
|
61
61
|
height: PropTypes.Requireable<string | number>;
|
|
62
62
|
}>>;
|
|
63
63
|
onOpen: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -75,6 +75,9 @@ export declare class AutoCompleteWithoutContext extends React.Component<AutoComp
|
|
|
75
75
|
* @hidden
|
|
76
76
|
*/
|
|
77
77
|
static defaultProps: {
|
|
78
|
+
size: "small" | "medium" | "large";
|
|
79
|
+
rounded: "small" | "medium" | "large" | "full";
|
|
80
|
+
fillMode: "solid" | "flat" | "outline";
|
|
78
81
|
popupSettings: {
|
|
79
82
|
height: string;
|
|
80
83
|
};
|
|
@@ -29,11 +29,13 @@ import ListContainer from './../common/ListContainer';
|
|
|
29
29
|
import List from './../common/List';
|
|
30
30
|
import DropDownBase from '../common/DropDownBase';
|
|
31
31
|
import { itemIndexStartsWith, getItemValue, areSame, getFocusedItem } from '../common/utils';
|
|
32
|
-
import { guid, Keys, classNames, createPropsContext, withPropsContext } from '@progress/kendo-react-common';
|
|
32
|
+
import { guid, Keys, classNames, createPropsContext, withPropsContext, kendoThemeMaps } from '@progress/kendo-react-common';
|
|
33
33
|
import { FloatingLabel } from '@progress/kendo-react-labels';
|
|
34
34
|
import { validatePackage } from '@progress/kendo-react-common';
|
|
35
35
|
import { packageMetadata } from '../package-metadata';
|
|
36
|
+
import ClearButton from '../common/ClearButton';
|
|
36
37
|
var VALIDATION_MESSAGE = 'Please enter a valid value!';
|
|
38
|
+
var sizeMap = kendoThemeMaps.sizeMap, roundedMap = kendoThemeMaps.roundedMap;
|
|
37
39
|
/** @hidden */
|
|
38
40
|
var AutoCompleteWithoutContext = /** @class */ (function (_super) {
|
|
39
41
|
__extends(AutoCompleteWithoutContext, _super);
|
|
@@ -288,9 +290,9 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
|
|
|
288
290
|
*/
|
|
289
291
|
AutoCompleteWithoutContext.prototype.render = function () {
|
|
290
292
|
var _this = this;
|
|
291
|
-
var _a
|
|
293
|
+
var _a;
|
|
294
|
+
var _b = this.props, dir = _b.dir, disabled = _b.disabled, label = _b.label, className = _b.className, style = _b.style, loading = _b.loading, suggest = _b.suggest, size = _b.size, rounded = _b.rounded, fillMode = _b.fillMode;
|
|
292
295
|
var isValid = !this.validityStyles || this.validity.valid;
|
|
293
|
-
var focused = this.state.focused;
|
|
294
296
|
var base = this.base;
|
|
295
297
|
var value = this.value;
|
|
296
298
|
var renderClearButton = this.props.clearButton !== false && !loading && !!value;
|
|
@@ -298,18 +300,24 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
|
|
|
298
300
|
if (typeof suggest === 'string') {
|
|
299
301
|
this._suggested = suggest;
|
|
300
302
|
}
|
|
301
|
-
var autoComplete = (React.createElement("span", { className: classNames('k-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
303
|
+
var autoComplete = (React.createElement("span", { className: classNames('k-autocomplete k-input', className, (_a = {},
|
|
304
|
+
_a["k-input-" + (sizeMap[size] || size)] = size,
|
|
305
|
+
_a["k-rounded-" + (roundedMap[rounded] || rounded)] = rounded,
|
|
306
|
+
_a["k-input-" + fillMode] = fillMode,
|
|
307
|
+
_a['k-valid'] = isValid,
|
|
308
|
+
_a['k-invalid'] = !isValid,
|
|
309
|
+
_a['k-loading'] = loading,
|
|
310
|
+
_a['k-required'] = this.required,
|
|
311
|
+
_a['k-disabled'] = disabled,
|
|
312
|
+
_a)), ref: function (element) {
|
|
306
313
|
_this._element = element;
|
|
307
314
|
base.wrapper = element;
|
|
308
315
|
}, style: !label
|
|
309
316
|
? style
|
|
310
317
|
: __assign({}, style, { width: undefined }), dir: dir },
|
|
311
|
-
this.renderSearchBar(
|
|
318
|
+
this.renderSearchBar(value || '', id),
|
|
312
319
|
loading && React.createElement("span", { className: "k-icon k-i-loading" }),
|
|
320
|
+
renderClearButton && !loading && React.createElement(ClearButton, { onClick: this.clearButtonClick, key: "clearbutton" }),
|
|
313
321
|
this.renderListContainer()));
|
|
314
322
|
return label
|
|
315
323
|
? (React.createElement(FloatingLabel, { label: label, editorId: id, editorValue: value, editorValid: isValid, editorDisabled: disabled, style: { width: style ? style.width : undefined }, children: autoComplete }))
|
|
@@ -353,17 +361,18 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
|
|
|
353
361
|
}
|
|
354
362
|
this.applyState(state);
|
|
355
363
|
};
|
|
356
|
-
AutoCompleteWithoutContext.prototype.renderSearchBar = function (
|
|
364
|
+
AutoCompleteWithoutContext.prototype.renderSearchBar = function (value, id) {
|
|
357
365
|
var _this = this;
|
|
358
366
|
var base = this.base;
|
|
359
367
|
var _a = this.props, placeholder = _a.placeholder, tabIndex = _a.tabIndex, disabled = _a.disabled, readonly = _a.readonly;
|
|
360
368
|
var focused = this.state.focused;
|
|
361
369
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
362
|
-
return (React.createElement(SearchBar, { id: id, placeholder: placeholder, tabIndex: tabIndex || undefined, accessKey: this.props.accessKey, value: value, suggestedText: this._suggested, focused: focused, name: this.props.name, ref: function (searchbar) { return _this._input = searchbar && searchbar.input; }, onKeyDown: this.onInputKeyDown, onChange: this.onChangeHandler, onFocus: base.handleFocus, onBlur: this.handleBlur, disabled: disabled, readOnly: readonly, expanded: opened, owns: base.listBoxId, activedescendant: 'option-' + base.guid + '-' + this.focusedIndex(), role: "combobox",
|
|
370
|
+
return (React.createElement(SearchBar, { id: id, placeholder: placeholder, tabIndex: tabIndex || undefined, accessKey: this.props.accessKey, value: value, suggestedText: this._suggested, focused: focused, name: this.props.name, ref: function (searchbar) { return _this._input = searchbar && searchbar.input; }, onKeyDown: this.onInputKeyDown, onChange: this.onChangeHandler, onFocus: base.handleFocus, onBlur: this.handleBlur, disabled: disabled, readOnly: readonly, expanded: opened, owns: base.listBoxId, activedescendant: 'option-' + base.guid + '-' + this.focusedIndex(), role: "combobox", ariaLabelledBy: this.props.ariaLabelledBy, ariaDescribedBy: this.props.ariaDescribedBy, render: this.props.valueRender }));
|
|
363
371
|
};
|
|
364
372
|
AutoCompleteWithoutContext.prototype.renderListContainer = function () {
|
|
373
|
+
var _a;
|
|
365
374
|
var base = this.base;
|
|
366
|
-
var
|
|
375
|
+
var _b = this.props, dir = _b.dir, header = _b.header, footer = _b.footer, _c = _b.data, data = _c === void 0 ? [] : _c, size = _b.size;
|
|
367
376
|
var popupSettings = base.getPopupSettings();
|
|
368
377
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
369
378
|
var popupWidth = popupSettings.width !== undefined ? popupSettings.width : base.popupWidth;
|
|
@@ -371,13 +380,15 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
|
|
|
371
380
|
animate: popupSettings.animate,
|
|
372
381
|
anchor: this.element,
|
|
373
382
|
show: opened,
|
|
374
|
-
popupClass: popupSettings.popupClass,
|
|
375
|
-
|
|
383
|
+
popupClass: classNames(popupSettings.popupClass, 'k-list', (_a = {},
|
|
384
|
+
_a["k-list-" + (sizeMap[size] || size)] = size,
|
|
385
|
+
_a)),
|
|
386
|
+
className: popupSettings.className,
|
|
376
387
|
appendTo: popupSettings.appendTo
|
|
377
388
|
}, dir: dir !== undefined ? dir : this.base.dirCalculated, itemsCount: [data.length] },
|
|
378
|
-
header,
|
|
389
|
+
header && React.createElement("div", { className: "k-list-header" }, header),
|
|
379
390
|
this.renderList(),
|
|
380
|
-
footer));
|
|
391
|
+
footer && React.createElement("div", { className: "k-list-footer" }, footer)));
|
|
381
392
|
};
|
|
382
393
|
AutoCompleteWithoutContext.prototype.renderList = function () {
|
|
383
394
|
var base = this.base;
|
|
@@ -385,7 +396,7 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
|
|
|
385
396
|
var _a = this.props, textField = _a.textField, _b = _a.data, data = _b === void 0 ? [] : _b, listNoDataRender = _a.listNoDataRender, itemRender = _a.itemRender;
|
|
386
397
|
var value = this.value;
|
|
387
398
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
388
|
-
return (React.createElement(List, { id: base.listBoxId, show: opened, data: data.slice(), focusedIndex: this.focusedIndex(), value: value, textField: textField, valueField: textField, highlightSelected: false, optionsGuid: base.guid, listRef: function (list) { return base.list = list; }, wrapperStyle: { maxHeight: popupSettings.height }, wrapperCssClass: "k-list-
|
|
399
|
+
return (React.createElement(List, { id: base.listBoxId, show: opened, data: data.slice(), focusedIndex: this.focusedIndex(), value: value, textField: textField, valueField: textField, highlightSelected: false, optionsGuid: base.guid, listRef: function (list) { return base.list = list; }, wrapperStyle: { maxHeight: popupSettings.height }, wrapperCssClass: "k-list-content", onClick: this.handleItemClick, itemRender: itemRender, noDataRender: listNoDataRender, onMouseDown: function (e) { return e.preventDefault(); } }));
|
|
389
400
|
};
|
|
390
401
|
AutoCompleteWithoutContext.prototype.triggerOnChange = function (newValue, state, eventArgs) {
|
|
391
402
|
if (this.value === newValue && !eventArgs) {
|
|
@@ -425,11 +436,11 @@ var AutoCompleteWithoutContext = /** @class */ (function (_super) {
|
|
|
425
436
|
/**
|
|
426
437
|
* @hidden
|
|
427
438
|
*/
|
|
428
|
-
AutoCompleteWithoutContext.propTypes = __assign({}, DropDownBase.basicPropTypes, { suggest: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), placeholder: PropTypes.string, value: PropTypes.string, defaultValue: PropTypes.string, validationMessage: PropTypes.string, required: PropTypes.bool, readonly: PropTypes.bool, clearButton: PropTypes.bool, valueRender: PropTypes.func, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string });
|
|
439
|
+
AutoCompleteWithoutContext.propTypes = __assign({}, DropDownBase.basicPropTypes, { size: PropTypes.oneOf([null, 'small', 'medium', 'large']), rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']), fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline']), suggest: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), placeholder: PropTypes.string, value: PropTypes.string, defaultValue: PropTypes.string, validationMessage: PropTypes.string, required: PropTypes.bool, readonly: PropTypes.bool, clearButton: PropTypes.bool, valueRender: PropTypes.func, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string });
|
|
429
440
|
/**
|
|
430
441
|
* @hidden
|
|
431
442
|
*/
|
|
432
|
-
AutoCompleteWithoutContext.defaultProps = __assign({}, DropDownBase.defaultProps);
|
|
443
|
+
AutoCompleteWithoutContext.defaultProps = __assign({}, DropDownBase.defaultProps, { size: 'medium', rounded: 'medium', fillMode: 'solid' });
|
|
433
444
|
return AutoCompleteWithoutContext;
|
|
434
445
|
}(React.Component));
|
|
435
446
|
export { AutoCompleteWithoutContext };
|
|
@@ -177,4 +177,41 @@ export interface AutoCompleteProps extends FormComponentProps {
|
|
|
177
177
|
* Sets the footer component of the AutoComplete ([see example]({% slug customrendering_autocomplete %}#toc-headers-and-footers)).
|
|
178
178
|
*/
|
|
179
179
|
footer?: React.ReactNode;
|
|
180
|
+
/**
|
|
181
|
+
* Configures the `size` of the AutoComplete.
|
|
182
|
+
*
|
|
183
|
+
* The available options are:
|
|
184
|
+
* - small
|
|
185
|
+
* - medium
|
|
186
|
+
* - large
|
|
187
|
+
* - null—Does not set a size `className`.
|
|
188
|
+
*
|
|
189
|
+
* @default `medium`
|
|
190
|
+
*/
|
|
191
|
+
size?: null | 'small' | 'medium' | 'large';
|
|
192
|
+
/**
|
|
193
|
+
* Configures the `roundness` of the AutoComplete.
|
|
194
|
+
*
|
|
195
|
+
* The available options are:
|
|
196
|
+
* - small
|
|
197
|
+
* - medium
|
|
198
|
+
* - large
|
|
199
|
+
* - full
|
|
200
|
+
* - null—Does not set a rounded `className`.
|
|
201
|
+
*
|
|
202
|
+
* @default `medium`
|
|
203
|
+
*/
|
|
204
|
+
rounded?: null | 'small' | 'medium' | 'large' | 'full';
|
|
205
|
+
/**
|
|
206
|
+
* Configures the `fillMode` of the AutoComplete.
|
|
207
|
+
*
|
|
208
|
+
* The available options are:
|
|
209
|
+
* - solid
|
|
210
|
+
* - flat
|
|
211
|
+
* - outline
|
|
212
|
+
* - null—Does not set a fillMode `className`.
|
|
213
|
+
*
|
|
214
|
+
* @default `solid`
|
|
215
|
+
*/
|
|
216
|
+
fillMode?: null | 'solid' | 'flat' | 'outline';
|
|
180
217
|
}
|
|
@@ -24,6 +24,9 @@ export declare class ComboBoxWithoutContext extends React.Component<ComboBoxProp
|
|
|
24
24
|
* @hidden
|
|
25
25
|
*/
|
|
26
26
|
static propTypes: {
|
|
27
|
+
size: PropTypes.Requireable<"small" | "medium" | "large">;
|
|
28
|
+
rounded: PropTypes.Requireable<"small" | "medium" | "large" | "full">;
|
|
29
|
+
fillMode: PropTypes.Requireable<"solid" | "flat" | "outline">;
|
|
27
30
|
dataItemKey: PropTypes.Requireable<string>;
|
|
28
31
|
groupField: PropTypes.Requireable<string>;
|
|
29
32
|
suggest: PropTypes.Requireable<boolean>;
|
|
@@ -66,7 +69,7 @@ export declare class ComboBoxWithoutContext extends React.Component<ComboBoxProp
|
|
|
66
69
|
}>>;
|
|
67
70
|
popupClass: PropTypes.Requireable<string>;
|
|
68
71
|
className: PropTypes.Requireable<string>;
|
|
69
|
-
appendTo: PropTypes.Requireable<
|
|
72
|
+
appendTo: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
70
73
|
width: PropTypes.Requireable<string | number>;
|
|
71
74
|
height: PropTypes.Requireable<string | number>;
|
|
72
75
|
}>>;
|
|
@@ -85,6 +88,9 @@ export declare class ComboBoxWithoutContext extends React.Component<ComboBoxProp
|
|
|
85
88
|
* @hidden
|
|
86
89
|
*/
|
|
87
90
|
static defaultProps: {
|
|
91
|
+
size: "small" | "medium" | "large";
|
|
92
|
+
rounded: "small" | "medium" | "large" | "full";
|
|
93
|
+
fillMode: "solid" | "flat" | "outline";
|
|
88
94
|
allowCustom: boolean;
|
|
89
95
|
clearButton: boolean;
|
|
90
96
|
required: boolean;
|
|
@@ -155,6 +161,7 @@ export declare class ComboBoxWithoutContext extends React.Component<ComboBoxProp
|
|
|
155
161
|
* @hidden
|
|
156
162
|
*/
|
|
157
163
|
onNavigate(state: InternalState, keyCode: number): void;
|
|
164
|
+
private componentRef;
|
|
158
165
|
private toggleBtnClick;
|
|
159
166
|
private applyValueOnEnter;
|
|
160
167
|
private applyValueOnRejectSuggestions;
|
|
@@ -25,7 +25,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
25
25
|
import * as React from 'react';
|
|
26
26
|
import * as PropTypes from 'prop-types';
|
|
27
27
|
import DropDownBase from '../common/DropDownBase';
|
|
28
|
-
import { guid, classNames, Keys, createPropsContext, withPropsContext } from '@progress/kendo-react-common';
|
|
28
|
+
import { guid, classNames, Keys, createPropsContext, withPropsContext, kendoThemeMaps } from '@progress/kendo-react-common';
|
|
29
29
|
import { FloatingLabel } from '@progress/kendo-react-labels';
|
|
30
30
|
import { areSame, itemIndexStartsWith, getItemIndexByText, getItemValue, isPresent, suggestValue } from '../common/utils';
|
|
31
31
|
import SearchBar from '../common/SearchBar';
|
|
@@ -33,7 +33,9 @@ import ListContainer from '../common/ListContainer';
|
|
|
33
33
|
import List from '../common/List';
|
|
34
34
|
import { validatePackage } from '@progress/kendo-react-common';
|
|
35
35
|
import { packageMetadata } from '../package-metadata';
|
|
36
|
+
import ClearButton from '../common/ClearButton';
|
|
36
37
|
var VALIDATION_MESSAGE = 'Please enter a valid value!';
|
|
38
|
+
var sizeMap = kendoThemeMaps.sizeMap, roundedMap = kendoThemeMaps.roundedMap;
|
|
37
39
|
/** @hidden */
|
|
38
40
|
var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
39
41
|
__extends(ComboBoxWithoutContext, _super);
|
|
@@ -71,6 +73,10 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
71
73
|
_this.base.triggerPageChangeCornerItems(item, state);
|
|
72
74
|
}
|
|
73
75
|
};
|
|
76
|
+
_this.componentRef = function (element) {
|
|
77
|
+
_this._element = element;
|
|
78
|
+
_this.base.wrapper = element;
|
|
79
|
+
};
|
|
74
80
|
_this.toggleBtnClick = function (event) {
|
|
75
81
|
var state = _this.base.initState();
|
|
76
82
|
state.syntheticEvent = event;
|
|
@@ -78,11 +84,12 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
78
84
|
_this.applyState(state);
|
|
79
85
|
};
|
|
80
86
|
_this.onScroll = function (event) {
|
|
81
|
-
var _a = _this.
|
|
87
|
+
var _a = _this.base, vs = _a.vs, list = _a.list;
|
|
88
|
+
vs.scrollHandler(event);
|
|
89
|
+
var _b = _this.props, _c = _b.data, data = _c === void 0 ? [] : _c, groupField = _b.groupField;
|
|
82
90
|
if (!groupField || !data.length) {
|
|
83
91
|
return;
|
|
84
92
|
}
|
|
85
|
-
var _c = _this.base, vs = _c.vs, list = _c.list;
|
|
86
93
|
var itemHeight = _this.itemHeight =
|
|
87
94
|
_this.itemHeight || (vs.enabled ? vs.itemHeight : (list ? list.children[0].offsetHeight : 0));
|
|
88
95
|
var target = event.target;
|
|
@@ -347,9 +354,8 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
347
354
|
* @hidden
|
|
348
355
|
*/
|
|
349
356
|
ComboBoxWithoutContext.prototype.render = function () {
|
|
350
|
-
var
|
|
351
|
-
var
|
|
352
|
-
var focused = this.state.focused;
|
|
357
|
+
var _a, _b;
|
|
358
|
+
var _c = this.props, dir = _c.dir, disabled = _c.disabled, _d = _c.clearButton, clearButton = _d === void 0 ? ComboBoxWithoutContext.defaultProps.clearButton : _d, label = _c.label, textField = _c.textField, className = _c.className, style = _c.style, loading = _c.loading, iconClassName = _c.iconClassName, virtual = _c.virtual, size = _c.size, rounded = _c.rounded, fillMode = _c.fillMode;
|
|
353
359
|
var isValid = !this.validityStyles || this.validity.valid;
|
|
354
360
|
var text = this.props.filter !== undefined ? this.props.filter : this.state.text;
|
|
355
361
|
var selectedItemText = getItemValue(this.value, textField);
|
|
@@ -364,22 +370,27 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
364
370
|
vs.total = virtual.total;
|
|
365
371
|
vs.pageSize = virtual.pageSize;
|
|
366
372
|
}
|
|
367
|
-
var combobox = (React.createElement("span", { className: classNames('k-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
373
|
+
var combobox = (React.createElement("span", { className: classNames('k-combobox k-input', (_a = {},
|
|
374
|
+
_a["k-input-" + (sizeMap[size] || size)] = size,
|
|
375
|
+
_a["k-rounded-" + (roundedMap[rounded] || rounded)] = rounded,
|
|
376
|
+
_a["k-input-" + fillMode] = fillMode,
|
|
377
|
+
_a['k-valid'] = isValid,
|
|
378
|
+
_a['k-invalid'] = !isValid,
|
|
379
|
+
_a['k-loading'] = loading,
|
|
380
|
+
_a['k-required'] = this.required,
|
|
381
|
+
_a['k-disabled'] = disabled,
|
|
382
|
+
_a), className), ref: this.componentRef, style: !label
|
|
371
383
|
? style
|
|
372
384
|
: __assign({}, style, { width: undefined }), dir: dir },
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
}) }))),
|
|
385
|
+
this.renderSearchBar(inputText || '', id),
|
|
386
|
+
renderClearButton && !loading && React.createElement(ClearButton, { onClick: this.clearButtonClick, key: "clearbutton" }),
|
|
387
|
+
loading && React.createElement("span", { className: "k-icon k-i-loading", key: "loading" }),
|
|
388
|
+
React.createElement("button", { type: "button", className: classNames('k-input-button k-button k-icon-button', (_b = {},
|
|
389
|
+
_b["k-button-" + (sizeMap[size] || size)] = size,
|
|
390
|
+
_b["k-button-" + fillMode] = fillMode,
|
|
391
|
+
_b["k-button-" + fillMode + "-base"] = fillMode,
|
|
392
|
+
_b)), onClick: this.toggleBtnClick, onMouseDown: function (e) { return e.preventDefault(); } },
|
|
393
|
+
React.createElement("span", { className: classNames('k-button-icon k-icon k-i-arrow-s', iconClassName) })),
|
|
383
394
|
this.renderListContainer()));
|
|
384
395
|
return label
|
|
385
396
|
? (React.createElement(FloatingLabel, { label: label, editorId: id, editorValue: inputText, editorValid: isValid, editorDisabled: disabled, style: { width: style ? style.width : undefined }, children: combobox }))
|
|
@@ -496,8 +507,9 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
496
507
|
return this.applyState(state);
|
|
497
508
|
};
|
|
498
509
|
ComboBoxWithoutContext.prototype.renderListContainer = function () {
|
|
510
|
+
var _a;
|
|
499
511
|
var base = this.base;
|
|
500
|
-
var
|
|
512
|
+
var _b = this.props, dir = _b.dir, header = _b.header, footer = _b.footer, _c = _b.data, data = _c === void 0 ? [] : _c, groupField = _b.groupField, size = _b.size;
|
|
501
513
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
502
514
|
var popupSettings = base.getPopupSettings();
|
|
503
515
|
var popupWidth = popupSettings.width !== undefined ? popupSettings.width : base.popupWidth;
|
|
@@ -509,14 +521,17 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
509
521
|
animate: popupSettings.animate,
|
|
510
522
|
anchor: this.element,
|
|
511
523
|
show: opened,
|
|
512
|
-
popupClass: popupSettings.popupClass,
|
|
513
|
-
|
|
524
|
+
popupClass: classNames(popupSettings.popupClass, 'k-list', (_a = {},
|
|
525
|
+
_a["k-list-" + (sizeMap[size] || size)] = size,
|
|
526
|
+
_a['k-virtual-list'] = this.base.vs.enabled,
|
|
527
|
+
_a)),
|
|
528
|
+
className: popupSettings.className,
|
|
514
529
|
appendTo: popupSettings.appendTo
|
|
515
530
|
}, dir: dir !== undefined ? dir : this.base.dirCalculated, itemsCount: [data.length] },
|
|
516
|
-
header,
|
|
531
|
+
header && React.createElement("div", { className: "k-list-header" }, header),
|
|
517
532
|
group && React.createElement("div", { className: "k-group-header" }, group),
|
|
518
|
-
|
|
519
|
-
footer));
|
|
533
|
+
this.renderList(),
|
|
534
|
+
footer && React.createElement("div", { className: "k-list-footer" }, footer)));
|
|
520
535
|
};
|
|
521
536
|
ComboBoxWithoutContext.prototype.renderList = function () {
|
|
522
537
|
var _this = this;
|
|
@@ -532,11 +547,9 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
532
547
|
var selectedItemText = getItemValue(this.value, textField);
|
|
533
548
|
var value = isPresent(text) && text !== selectedItemText ? null : this.value;
|
|
534
549
|
var ListComponent = this.props.list || List;
|
|
535
|
-
return (React.createElement(ListComponent, { id: base.listBoxId, show: opened, data: data, focusedIndex: focusedIndex, value: value, textField: textField, valueField: dataItemKey, groupField: this.props.groupField, optionsGuid: base.guid, listRef: function (list) { vs.list = _this.base.list = list; _this.itemHeight = 0; }, wrapperStyle:
|
|
536
|
-
{ maxHeight: popupSettings.height } : { float: 'left', width: '100%' }, wrapperCssClass: !vs.enabled ? 'k-list-scroller' : undefined, listStyle: vs.enabled ?
|
|
537
|
-
{ transform: translate } : undefined, key: "listkey", skip: skip, onClick: this.handleItemClick, itemRender: itemRender, noDataRender: listNoDataRender, onMouseDown: function (e) { return e.preventDefault(); }, onScroll: this.onScroll }));
|
|
550
|
+
return (React.createElement(ListComponent, { id: base.listBoxId, show: opened, data: data, focusedIndex: focusedIndex, value: value, textField: textField, valueField: dataItemKey, groupField: this.props.groupField, optionsGuid: base.guid, listRef: function (list) { vs.list = _this.base.list = list; _this.itemHeight = 0; }, wrapperStyle: { maxHeight: popupSettings.height }, wrapperCssClass: "k-list-content", listStyle: vs.enabled ? { transform: translate } : undefined, key: "listkey", skip: skip, onClick: this.handleItemClick, itemRender: itemRender, noDataRender: listNoDataRender, onMouseDown: function (e) { return e.preventDefault(); }, onScroll: this.onScroll, wrapperRef: vs.scrollerRef, scroller: this.base.renderScrollElement() }));
|
|
538
551
|
};
|
|
539
|
-
ComboBoxWithoutContext.prototype.renderSearchBar = function (
|
|
552
|
+
ComboBoxWithoutContext.prototype.renderSearchBar = function (text, id) {
|
|
540
553
|
var _this = this;
|
|
541
554
|
var _a = this.props, placeholder = _a.placeholder, 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;
|
|
542
555
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
@@ -545,7 +558,7 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
545
558
|
if (this._suggested && !areSame(this._valueOnDidUpdate, value, dataItemKey)) {
|
|
546
559
|
this._suggested = '';
|
|
547
560
|
}
|
|
548
|
-
return (React.createElement(SearchBar, { id: id, placeholder: placeholder, tabIndex: tabIndex || undefined, accessKey: this.props.accessKey, value: text + this._suggested, suggestedText: this._suggested, ref: function (el) { return _this._input = el && el.input; }, onKeyDown: this.onInputKeyDown, onChange: this.inputOnChange, onFocus: this.base.handleFocus, onBlur: this.handleBlur, disabled: disabled, expanded: opened, owns: this.base.listBoxId, activedescendant: this.base.guid + '-' + (selectedIndex + virtual.skip), role: "combobox",
|
|
561
|
+
return (React.createElement(SearchBar, { id: id, placeholder: placeholder, tabIndex: tabIndex || undefined, accessKey: this.props.accessKey, value: text + this._suggested, suggestedText: this._suggested, ref: function (el) { return _this._input = el && el.input; }, onKeyDown: this.onInputKeyDown, onChange: this.inputOnChange, onFocus: this.base.handleFocus, onBlur: this.handleBlur, disabled: disabled, expanded: opened, owns: this.base.listBoxId, activedescendant: this.base.guid + '-' + (selectedIndex + virtual.skip), role: "combobox", ariaLabelledBy: this.props.ariaLabelledBy, ariaDescribedBy: this.props.ariaDescribedBy, render: this.props.valueRender }));
|
|
549
562
|
};
|
|
550
563
|
ComboBoxWithoutContext.prototype.triggerOnChange = function (item, state) {
|
|
551
564
|
var value = this.value;
|
|
@@ -584,11 +597,11 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
584
597
|
/**
|
|
585
598
|
* @hidden
|
|
586
599
|
*/
|
|
587
|
-
ComboBoxWithoutContext.propTypes = __assign({}, DropDownBase.propTypes, { dataItemKey: PropTypes.string, groupField: PropTypes.string, suggest: PropTypes.bool, placeholder: PropTypes.string, allowCustom: PropTypes.bool, clearButton: PropTypes.bool, iconClassName: PropTypes.string, validationMessage: PropTypes.string, required: PropTypes.bool, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string, list: PropTypes.any, valueRender: PropTypes.func });
|
|
600
|
+
ComboBoxWithoutContext.propTypes = __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, suggest: PropTypes.bool, placeholder: PropTypes.string, allowCustom: PropTypes.bool, clearButton: PropTypes.bool, iconClassName: PropTypes.string, validationMessage: PropTypes.string, required: PropTypes.bool, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string, list: PropTypes.any, valueRender: PropTypes.func });
|
|
588
601
|
/**
|
|
589
602
|
* @hidden
|
|
590
603
|
*/
|
|
591
|
-
ComboBoxWithoutContext.defaultProps = __assign({}, DropDownBase.defaultProps, { allowCustom: false, clearButton: true, required: false });
|
|
604
|
+
ComboBoxWithoutContext.defaultProps = __assign({}, DropDownBase.defaultProps, { size: 'medium', rounded: 'medium', fillMode: 'solid', allowCustom: false, clearButton: true, required: false });
|
|
592
605
|
return ComboBoxWithoutContext;
|
|
593
606
|
}(React.Component));
|
|
594
607
|
export { ComboBoxWithoutContext };
|
|
@@ -221,4 +221,41 @@ export interface ComboBoxProps extends FormComponentProps {
|
|
|
221
221
|
* @hidden
|
|
222
222
|
*/
|
|
223
223
|
list?: any;
|
|
224
|
+
/**
|
|
225
|
+
* Configures the `size` of the ComboBox.
|
|
226
|
+
*
|
|
227
|
+
* The available options are:
|
|
228
|
+
* - small
|
|
229
|
+
* - medium
|
|
230
|
+
* - large
|
|
231
|
+
* - null—Does not set a size `className`.
|
|
232
|
+
*
|
|
233
|
+
* @default `medium`
|
|
234
|
+
*/
|
|
235
|
+
size?: null | 'small' | 'medium' | 'large';
|
|
236
|
+
/**
|
|
237
|
+
* Configures the `roundness` of the ComboBox.
|
|
238
|
+
*
|
|
239
|
+
* The available options are:
|
|
240
|
+
* - small
|
|
241
|
+
* - medium
|
|
242
|
+
* - large
|
|
243
|
+
* - full
|
|
244
|
+
* - null—Does not set a rounded `className`.
|
|
245
|
+
*
|
|
246
|
+
* @default `medium`
|
|
247
|
+
*/
|
|
248
|
+
rounded?: null | 'small' | 'medium' | 'large' | 'full';
|
|
249
|
+
/**
|
|
250
|
+
* Configures the `fillMode` of the ComboBox.
|
|
251
|
+
*
|
|
252
|
+
* The available options are:
|
|
253
|
+
* - solid
|
|
254
|
+
* - flat
|
|
255
|
+
* - outline
|
|
256
|
+
* - null—Does not set a fillMode `className`.
|
|
257
|
+
*
|
|
258
|
+
* @default `solid`
|
|
259
|
+
*/
|
|
260
|
+
fillMode?: null | 'solid' | 'flat' | 'outline';
|
|
224
261
|
}
|
|
@@ -23,9 +23,6 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
|
|
|
23
23
|
filterable: PropTypes.Requireable<boolean>;
|
|
24
24
|
filter: PropTypes.Requireable<string>;
|
|
25
25
|
virtual: PropTypes.Requireable<PropTypes.InferProps<{
|
|
26
|
-
/**
|
|
27
|
-
* The value of the DropDownList.
|
|
28
|
-
*/
|
|
29
26
|
pageSize: PropTypes.Validator<number>;
|
|
30
27
|
skip: PropTypes.Validator<number>;
|
|
31
28
|
total: PropTypes.Validator<number>;
|
|
@@ -49,7 +46,7 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
|
|
|
49
46
|
}>>;
|
|
50
47
|
popupClass: PropTypes.Requireable<string>;
|
|
51
48
|
className: PropTypes.Requireable<string>;
|
|
52
|
-
appendTo: PropTypes.Requireable<
|
|
49
|
+
appendTo: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
53
50
|
width: PropTypes.Requireable<string | number>;
|
|
54
51
|
height: PropTypes.Requireable<string | number>;
|
|
55
52
|
}>>;
|
|
@@ -62,9 +59,7 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
|
|
|
62
59
|
listNoDataRender: PropTypes.Requireable<(...args: any[]) => any>;
|
|
63
60
|
focusedItemIndex: PropTypes.Requireable<(...args: any[]) => any>;
|
|
64
61
|
header: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
65
|
-
footer: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
66
|
-
* @hidden
|
|
67
|
-
*/
|
|
62
|
+
footer: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
68
63
|
delay: PropTypes.Requireable<number>;
|
|
69
64
|
ignoreCase: PropTypes.Requireable<boolean>;
|
|
70
65
|
iconClassName: PropTypes.Requireable<string>;
|
|
@@ -84,6 +79,9 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
|
|
|
84
79
|
*/
|
|
85
80
|
static defaultProps: {
|
|
86
81
|
required: boolean;
|
|
82
|
+
size: "small" | "medium" | "large";
|
|
83
|
+
rounded: "small" | "medium" | "large" | "full";
|
|
84
|
+
fillMode: "solid" | "flat" | "outline";
|
|
87
85
|
popupSettings: {
|
|
88
86
|
height: string;
|
|
89
87
|
};
|
|
@@ -159,7 +157,7 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
|
|
|
159
157
|
* @hidden
|
|
160
158
|
*/
|
|
161
159
|
onNavigate(state: InternalState, keyCode: number): void;
|
|
162
|
-
private
|
|
160
|
+
private componentRef;
|
|
163
161
|
private dummySelect;
|
|
164
162
|
private renderListContainer;
|
|
165
163
|
private renderList;
|