@progress/kendo-react-dropdowns 4.13.0-dev.202111291459 → 4.13.0-dev.202111300702
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 +58 -23
- package/dist/es/AutoComplete/AutoComplete.js +65 -50
- package/dist/es/AutoComplete/AutoCompleteProps.d.ts +1 -1
- package/dist/es/ComboBox/ComboBox.d.ts +59 -23
- package/dist/es/ComboBox/ComboBox.js +69 -54
- package/dist/es/ComboBox/ComboBoxProps.d.ts +1 -1
- package/dist/es/DropDownList/DropDownList.d.ts +65 -22
- package/dist/es/DropDownList/DropDownList.js +63 -46
- package/dist/es/DropDownList/DropDownListProps.d.ts +1 -1
- package/dist/es/DropDownTree/DropDownTree.d.ts +10 -0
- package/dist/es/DropDownTree/DropDownTree.js +13 -2
- package/dist/es/MultiColumnComboBox/MultiColumnComboBox.d.ts +11 -0
- package/dist/es/MultiColumnComboBox/MultiColumnComboBox.js +16 -4
- package/dist/es/MultiSelect/MultiSelect.d.ts +58 -23
- package/dist/es/MultiSelect/MultiSelect.js +65 -50
- package/dist/es/MultiSelect/MultiSelectProps.d.ts +1 -1
- package/dist/es/MultiSelectTree/MultiSelectTree.d.ts +10 -0
- package/dist/es/MultiSelectTree/MultiSelectTree.js +13 -2
- package/dist/es/main.d.ts +8 -8
- package/dist/es/main.js +8 -8
- package/dist/es/package-metadata.js +1 -1
- package/dist/npm/AutoComplete/AutoComplete.d.ts +58 -23
- package/dist/npm/AutoComplete/AutoComplete.js +64 -49
- package/dist/npm/AutoComplete/AutoCompleteProps.d.ts +1 -1
- package/dist/npm/ComboBox/ComboBox.d.ts +59 -23
- package/dist/npm/ComboBox/ComboBox.js +68 -53
- package/dist/npm/ComboBox/ComboBoxProps.d.ts +1 -1
- package/dist/npm/DropDownList/DropDownList.d.ts +65 -22
- package/dist/npm/DropDownList/DropDownList.js +62 -45
- package/dist/npm/DropDownList/DropDownListProps.d.ts +1 -1
- package/dist/npm/DropDownTree/DropDownTree.d.ts +10 -0
- package/dist/npm/DropDownTree/DropDownTree.js +12 -1
- package/dist/npm/MultiColumnComboBox/MultiColumnComboBox.d.ts +11 -0
- package/dist/npm/MultiColumnComboBox/MultiColumnComboBox.js +15 -3
- package/dist/npm/MultiSelect/MultiSelect.d.ts +58 -23
- package/dist/npm/MultiSelect/MultiSelect.js +64 -49
- package/dist/npm/MultiSelect/MultiSelectProps.d.ts +1 -1
- package/dist/npm/MultiSelectTree/MultiSelectTree.d.ts +10 -0
- package/dist/npm/MultiSelectTree/MultiSelectTree.js +12 -1
- package/dist/npm/main.d.ts +8 -8
- package/dist/npm/main.js +11 -4
- package/dist/npm/package-metadata.js +1 -1
- package/dist/systemjs/kendo-react-dropdowns.js +1 -1
- package/package.json +11 -8
|
@@ -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 } from '@progress/kendo-react-common';
|
|
28
|
+
import { guid, classNames, Keys, createPropsContext, withPropsContext } 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';
|
|
@@ -34,31 +34,10 @@ import List from '../common/List';
|
|
|
34
34
|
import { validatePackage } from '@progress/kendo-react-common';
|
|
35
35
|
import { packageMetadata } from '../package-metadata';
|
|
36
36
|
var VALIDATION_MESSAGE = 'Please enter a valid value!';
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
* ```jsx
|
|
42
|
-
* class App extends React.Component {
|
|
43
|
-
* combobox = null;
|
|
44
|
-
* render() {
|
|
45
|
-
* return (
|
|
46
|
-
* <div>
|
|
47
|
-
* <ComboBox
|
|
48
|
-
* data={[ "Albania", "Andorra", "Austria", "Belarus" ]}
|
|
49
|
-
* ref={component => this.combobox = component}
|
|
50
|
-
* />
|
|
51
|
-
* <button onClick={() => alert(this.combobox.value)}>alert value</button>
|
|
52
|
-
* </div>
|
|
53
|
-
* );
|
|
54
|
-
* }
|
|
55
|
-
* }
|
|
56
|
-
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
var ComboBox = /** @class */ (function (_super) {
|
|
60
|
-
__extends(ComboBox, _super);
|
|
61
|
-
function ComboBox(props) {
|
|
37
|
+
/** @hidden */
|
|
38
|
+
var ComboBoxWithoutContext = /** @class */ (function (_super) {
|
|
39
|
+
__extends(ComboBoxWithoutContext, _super);
|
|
40
|
+
function ComboBoxWithoutContext(props) {
|
|
62
41
|
var _this = _super.call(this, props) || this;
|
|
63
42
|
/**
|
|
64
43
|
* @hidden
|
|
@@ -227,7 +206,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
227
206
|
validatePackage(packageMetadata);
|
|
228
207
|
return _this;
|
|
229
208
|
}
|
|
230
|
-
Object.defineProperty(
|
|
209
|
+
Object.defineProperty(ComboBoxWithoutContext.prototype, "element", {
|
|
231
210
|
/**
|
|
232
211
|
* @hidden
|
|
233
212
|
*/
|
|
@@ -237,7 +216,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
237
216
|
enumerable: true,
|
|
238
217
|
configurable: true
|
|
239
218
|
});
|
|
240
|
-
Object.defineProperty(
|
|
219
|
+
Object.defineProperty(ComboBoxWithoutContext.prototype, "value", {
|
|
241
220
|
/**
|
|
242
221
|
* The value of the ComboBox.
|
|
243
222
|
*/
|
|
@@ -259,7 +238,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
259
238
|
enumerable: true,
|
|
260
239
|
configurable: true
|
|
261
240
|
});
|
|
262
|
-
Object.defineProperty(
|
|
241
|
+
Object.defineProperty(ComboBoxWithoutContext.prototype, "index", {
|
|
263
242
|
/**
|
|
264
243
|
* The index of the selected item.
|
|
265
244
|
*/
|
|
@@ -272,7 +251,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
272
251
|
enumerable: true,
|
|
273
252
|
configurable: true
|
|
274
253
|
});
|
|
275
|
-
Object.defineProperty(
|
|
254
|
+
Object.defineProperty(ComboBoxWithoutContext.prototype, "name", {
|
|
276
255
|
/**
|
|
277
256
|
* Gets the `name` property of the ComboBox.
|
|
278
257
|
*/
|
|
@@ -282,7 +261,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
282
261
|
enumerable: true,
|
|
283
262
|
configurable: true
|
|
284
263
|
});
|
|
285
|
-
Object.defineProperty(
|
|
264
|
+
Object.defineProperty(ComboBoxWithoutContext.prototype, "validity", {
|
|
286
265
|
/**
|
|
287
266
|
* Represents the validity state into which the component is set.
|
|
288
267
|
*/
|
|
@@ -302,23 +281,23 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
302
281
|
enumerable: true,
|
|
303
282
|
configurable: true
|
|
304
283
|
});
|
|
305
|
-
Object.defineProperty(
|
|
284
|
+
Object.defineProperty(ComboBoxWithoutContext.prototype, "validityStyles", {
|
|
306
285
|
get: function () {
|
|
307
286
|
return this.props.validityStyles !== undefined
|
|
308
287
|
? this.props.validityStyles
|
|
309
|
-
:
|
|
288
|
+
: ComboBoxWithoutContext.defaultProps.validityStyles;
|
|
310
289
|
},
|
|
311
290
|
enumerable: true,
|
|
312
291
|
configurable: true
|
|
313
292
|
});
|
|
314
|
-
Object.defineProperty(
|
|
293
|
+
Object.defineProperty(ComboBoxWithoutContext.prototype, "required", {
|
|
315
294
|
/**
|
|
316
295
|
* @hidden
|
|
317
296
|
*/
|
|
318
297
|
get: function () {
|
|
319
298
|
return this.props.required !== undefined
|
|
320
299
|
? this.props.required
|
|
321
|
-
:
|
|
300
|
+
: ComboBoxWithoutContext.defaultProps.required;
|
|
322
301
|
},
|
|
323
302
|
enumerable: true,
|
|
324
303
|
configurable: true
|
|
@@ -326,7 +305,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
326
305
|
/**
|
|
327
306
|
* @hidden
|
|
328
307
|
*/
|
|
329
|
-
|
|
308
|
+
ComboBoxWithoutContext.prototype.componentDidUpdate = function (prevProps, prevState) {
|
|
330
309
|
var _a = this.props, _b = _a.data, data = _b === void 0 ? [] : _b, dataItemKey = _a.dataItemKey, virtual = _a.virtual;
|
|
331
310
|
var prevTotal = prevProps.virtual ? prevProps.virtual.total : 0;
|
|
332
311
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
@@ -360,16 +339,16 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
360
339
|
/**
|
|
361
340
|
* @hidden
|
|
362
341
|
*/
|
|
363
|
-
|
|
342
|
+
ComboBoxWithoutContext.prototype.componentDidMount = function () {
|
|
364
343
|
this.base.didMount();
|
|
365
344
|
this.setValidity();
|
|
366
345
|
};
|
|
367
346
|
/**
|
|
368
347
|
* @hidden
|
|
369
348
|
*/
|
|
370
|
-
|
|
349
|
+
ComboBoxWithoutContext.prototype.render = function () {
|
|
371
350
|
var _this = this;
|
|
372
|
-
var _a = this.props, dir = _a.dir, disabled = _a.disabled, _b = _a.clearButton, clearButton = _b === void 0 ?
|
|
351
|
+
var _a = this.props, dir = _a.dir, disabled = _a.disabled, _b = _a.clearButton, clearButton = _b === void 0 ? ComboBoxWithoutContext.defaultProps.clearButton : _b, label = _a.label, textField = _a.textField, className = _a.className, style = _a.style, loading = _a.loading, iconClassName = _a.iconClassName, virtual = _a.virtual;
|
|
373
352
|
var focused = this.state.focused;
|
|
374
353
|
var isValid = !this.validityStyles || this.validity.valid;
|
|
375
354
|
var text = this.props.filter !== undefined ? this.props.filter : this.state.text;
|
|
@@ -409,7 +388,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
409
388
|
/**
|
|
410
389
|
* @hidden
|
|
411
390
|
*/
|
|
412
|
-
|
|
391
|
+
ComboBoxWithoutContext.prototype.onNavigate = function (state, keyCode) {
|
|
413
392
|
var _a = this.props, _b = _a.data, data = _b === void 0 ? [] : _b, _c = _a.virtual, virtual = _c === void 0 ? { skip: 0 } : _c;
|
|
414
393
|
var text = this.props.filter ? this.props.filter : this.state.text;
|
|
415
394
|
var focusedIndex = this.getFocusedIndex();
|
|
@@ -435,7 +414,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
435
414
|
}
|
|
436
415
|
}
|
|
437
416
|
};
|
|
438
|
-
|
|
417
|
+
ComboBoxWithoutContext.prototype.applyValueOnEnter = function (value, state) {
|
|
439
418
|
var _a;
|
|
440
419
|
var _b = this.props, _c = _b.data, data = _c === void 0 ? [] : _c, textField = _b.textField, allowCustom = _b.allowCustom;
|
|
441
420
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
@@ -465,7 +444,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
465
444
|
}
|
|
466
445
|
this.applyState(state);
|
|
467
446
|
};
|
|
468
|
-
|
|
447
|
+
ComboBoxWithoutContext.prototype.applyValueOnRejectSuggestions = function (text, state) {
|
|
469
448
|
var _a;
|
|
470
449
|
var _b = this.props, _c = _b.data, data = _c === void 0 ? [] : _c, textField = _b.textField, allowCustom = _b.allowCustom;
|
|
471
450
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
@@ -496,7 +475,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
496
475
|
}
|
|
497
476
|
this.applyState(state);
|
|
498
477
|
};
|
|
499
|
-
|
|
478
|
+
ComboBoxWithoutContext.prototype.selectFocusedItem = function (text, state) {
|
|
500
479
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
501
480
|
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;
|
|
502
481
|
var skip = virtual.skip;
|
|
@@ -516,7 +495,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
516
495
|
}
|
|
517
496
|
return this.applyState(state);
|
|
518
497
|
};
|
|
519
|
-
|
|
498
|
+
ComboBoxWithoutContext.prototype.renderListContainer = function () {
|
|
520
499
|
var base = this.base;
|
|
521
500
|
var _a = this.props, dir = _a.dir, header = _a.header, footer = _a.footer, _b = _a.data, data = _b === void 0 ? [] : _b, groupField = _a.groupField;
|
|
522
501
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
@@ -539,7 +518,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
539
518
|
base.renderScrollWrapper([this.renderList(), base.renderScrollElement()], this.onScroll),
|
|
540
519
|
footer));
|
|
541
520
|
};
|
|
542
|
-
|
|
521
|
+
ComboBoxWithoutContext.prototype.renderList = function () {
|
|
543
522
|
var _this = this;
|
|
544
523
|
var base = this.base;
|
|
545
524
|
var _a = this.props, textField = _a.textField, dataItemKey = _a.dataItemKey, listNoDataRender = _a.listNoDataRender, itemRender = _a.itemRender, _b = _a.data, data = _b === void 0 ? [] : _b, _c = _a.virtual, virtual = _c === void 0 ? { skip: 0 } : _c;
|
|
@@ -557,7 +536,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
557
536
|
{ maxHeight: popupSettings.height } : { float: 'left', width: '100%' }, wrapperCssClass: !vs.enabled ? 'k-list-scroller' : undefined, listStyle: vs.enabled ?
|
|
558
537
|
{ transform: translate } : undefined, key: "listkey", skip: skip, onClick: this.handleItemClick, itemRender: itemRender, noDataRender: listNoDataRender, onMouseDown: function (e) { return e.preventDefault(); }, onScroll: this.onScroll }));
|
|
559
538
|
};
|
|
560
|
-
|
|
539
|
+
ComboBoxWithoutContext.prototype.renderSearchBar = function (clearButton, text, id) {
|
|
561
540
|
var _this = this;
|
|
562
541
|
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;
|
|
563
542
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
@@ -568,7 +547,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
568
547
|
}
|
|
569
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", clearButton: clearButton, clearButtonClick: this.clearButtonClick, ariaLabelledBy: this.props.ariaLabelledBy, ariaDescribedBy: this.props.ariaDescribedBy, render: this.props.valueRender }));
|
|
570
549
|
};
|
|
571
|
-
|
|
550
|
+
ComboBoxWithoutContext.prototype.triggerOnChange = function (item, state) {
|
|
572
551
|
var value = this.value;
|
|
573
552
|
if ((!isPresent(value) && !isPresent(item)) || areSame(value, item, this.props.dataItemKey)) {
|
|
574
553
|
return;
|
|
@@ -579,7 +558,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
579
558
|
this._valueDuringOnChange = item;
|
|
580
559
|
state.events.push({ type: 'onChange' });
|
|
581
560
|
};
|
|
582
|
-
|
|
561
|
+
ComboBoxWithoutContext.prototype.getFocusedIndex = function () {
|
|
583
562
|
var value = this.value;
|
|
584
563
|
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;
|
|
585
564
|
var text = this.props.filter ? this.props.filter : this.state.text;
|
|
@@ -593,22 +572,58 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
593
572
|
return virtual.skip === 0 ? 0 : -1;
|
|
594
573
|
}
|
|
595
574
|
};
|
|
596
|
-
|
|
575
|
+
ComboBoxWithoutContext.prototype.suggestValue = function (value) {
|
|
597
576
|
var _a = this.props, data = _a.data, textField = _a.textField;
|
|
598
577
|
this._suggested = suggestValue(value, data, textField);
|
|
599
578
|
};
|
|
600
|
-
|
|
579
|
+
ComboBoxWithoutContext.prototype.applyState = function (state) {
|
|
601
580
|
this.base.applyState(state);
|
|
602
581
|
this._valueDuringOnChange = undefined;
|
|
603
582
|
};
|
|
583
|
+
ComboBoxWithoutContext.displayName = 'ComboBox';
|
|
604
584
|
/**
|
|
605
585
|
* @hidden
|
|
606
586
|
*/
|
|
607
|
-
|
|
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 });
|
|
608
588
|
/**
|
|
609
589
|
* @hidden
|
|
610
590
|
*/
|
|
611
|
-
|
|
612
|
-
return
|
|
591
|
+
ComboBoxWithoutContext.defaultProps = __assign({}, DropDownBase.defaultProps, { allowCustom: false, clearButton: true, required: false });
|
|
592
|
+
return ComboBoxWithoutContext;
|
|
613
593
|
}(React.Component));
|
|
614
|
-
export
|
|
594
|
+
export { ComboBoxWithoutContext };
|
|
595
|
+
/**
|
|
596
|
+
* Represents the PropsContext of the `ComboBox` component.
|
|
597
|
+
* Used for global configuration of all `ComboBox` instances.
|
|
598
|
+
*
|
|
599
|
+
* For more information, refer to the [Dropdowns Props Context]({% slug props-context_dropdowns %}) article.
|
|
600
|
+
*/
|
|
601
|
+
export var ComboBoxPropsContext = createPropsContext();
|
|
602
|
+
/* eslint-disable @typescript-eslint/no-redeclare -- intentionally naming the component the same as the type */
|
|
603
|
+
/**
|
|
604
|
+
* Represents the [KendoReact ComboBox component]({% slug overview_combobox %}).
|
|
605
|
+
*
|
|
606
|
+
* Accepts properties of type [ComboBoxProps]({% slug api_dropdowns_comboboxprops %}).
|
|
607
|
+
* Obtaining the `ref` returns an object of type [ComboBoxHandle]({% slug api_dropdowns_comboboxhandle %}).
|
|
608
|
+
*
|
|
609
|
+
* @example
|
|
610
|
+
* ```jsx
|
|
611
|
+
* class App extends React.Component {
|
|
612
|
+
* combobox = null;
|
|
613
|
+
* render() {
|
|
614
|
+
* return (
|
|
615
|
+
* <div>
|
|
616
|
+
* <ComboBox
|
|
617
|
+
* data={[ "Albania", "Andorra", "Austria", "Belarus" ]}
|
|
618
|
+
* ref={component => this.combobox = component}
|
|
619
|
+
* />
|
|
620
|
+
* <button onClick={() => alert(this.combobox.value)}>alert value</button>
|
|
621
|
+
* </div>
|
|
622
|
+
* );
|
|
623
|
+
* }
|
|
624
|
+
* }
|
|
625
|
+
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
626
|
+
* ```
|
|
627
|
+
*/
|
|
628
|
+
export var ComboBox = withPropsContext(ComboBoxPropsContext, ComboBoxWithoutContext);
|
|
629
|
+
ComboBox.displayName = 'KendoReactComboBox';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import ComboBox from './ComboBox';
|
|
2
|
+
import { ComboBox } from './ComboBox';
|
|
3
3
|
import { FilterChangeEvent, ChangeEvent, OpenEvent, CloseEvent, FocusEvent, BlurEvent, PageChangeEvent } from './../common/events';
|
|
4
4
|
import { FormComponentProps } from '@progress/kendo-react-common';
|
|
5
5
|
import { VirtualizationSettings, DropDownsPopupSettings } from '../common/settings';
|
|
@@ -10,28 +10,10 @@ import { DropDownStateBase, InternalState } from './../common/settings';
|
|
|
10
10
|
export interface DropDownListState extends DropDownStateBase {
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```jsx
|
|
17
|
-
* class App extends React.Component {
|
|
18
|
-
* dropdownlist = null;
|
|
19
|
-
* render() {
|
|
20
|
-
* return (
|
|
21
|
-
* <div>
|
|
22
|
-
* <DropDownList
|
|
23
|
-
* data={[ "Albania", "Andorra", "Austria", "Belarus" ]}
|
|
24
|
-
* ref={component => this.dropdownlist = component}
|
|
25
|
-
* />
|
|
26
|
-
* <button onClick={() => alert(this.dropdownlist.value)}>alert value</button>
|
|
27
|
-
* </div>
|
|
28
|
-
* );
|
|
29
|
-
* }
|
|
30
|
-
* }
|
|
31
|
-
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
32
|
-
* ```
|
|
13
|
+
* @hidden
|
|
33
14
|
*/
|
|
34
|
-
export
|
|
15
|
+
export declare class DropDownListWithoutContext extends React.Component<DropDownListProps, DropDownListState> implements FormComponent {
|
|
16
|
+
static displayName: string;
|
|
35
17
|
/**
|
|
36
18
|
* @hidden
|
|
37
19
|
*/
|
|
@@ -41,6 +23,9 @@ export default class DropDownList extends React.Component<DropDownListProps, Dro
|
|
|
41
23
|
filterable: PropTypes.Requireable<boolean>;
|
|
42
24
|
filter: PropTypes.Requireable<string>;
|
|
43
25
|
virtual: PropTypes.Requireable<PropTypes.InferProps<{
|
|
26
|
+
/**
|
|
27
|
+
* The value of the DropDownList.
|
|
28
|
+
*/
|
|
44
29
|
pageSize: PropTypes.Validator<number>;
|
|
45
30
|
skip: PropTypes.Validator<number>;
|
|
46
31
|
total: PropTypes.Validator<number>;
|
|
@@ -77,7 +62,9 @@ export default class DropDownList extends React.Component<DropDownListProps, Dro
|
|
|
77
62
|
listNoDataRender: PropTypes.Requireable<(...args: any[]) => any>;
|
|
78
63
|
focusedItemIndex: PropTypes.Requireable<(...args: any[]) => any>;
|
|
79
64
|
header: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
80
|
-
footer: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
65
|
+
footer: PropTypes.Requireable<PropTypes.ReactNodeLike>; /**
|
|
66
|
+
* @hidden
|
|
67
|
+
*/
|
|
81
68
|
delay: PropTypes.Requireable<number>;
|
|
82
69
|
ignoreCase: PropTypes.Requireable<boolean>;
|
|
83
70
|
iconClassName: PropTypes.Requireable<string>;
|
|
@@ -196,3 +183,59 @@ export default class DropDownList extends React.Component<DropDownListProps, Dro
|
|
|
196
183
|
private triggerOnChange;
|
|
197
184
|
private applyState;
|
|
198
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Represents the PropsContext of the `DropDownList` component.
|
|
188
|
+
* Used for global configuration of all `DropDownList` instances.
|
|
189
|
+
*
|
|
190
|
+
* For more information, refer to the [Dropdowns Props Context]({% slug props-context_dropdowns %}) article.
|
|
191
|
+
*/
|
|
192
|
+
export declare const DropDownListPropsContext: React.Context<(p: DropDownListProps) => DropDownListProps>;
|
|
193
|
+
/**
|
|
194
|
+
* Represent the `ref` of the DropDownList component.
|
|
195
|
+
*/
|
|
196
|
+
export interface DropDownListHandle extends Pick<DropDownListWithoutContext, keyof DropDownListWithoutContext> {
|
|
197
|
+
/**
|
|
198
|
+
* The index of the selected item.
|
|
199
|
+
*/
|
|
200
|
+
index: number;
|
|
201
|
+
/**
|
|
202
|
+
* Gets the `name` property of the DropDownList.
|
|
203
|
+
*/
|
|
204
|
+
name: string | undefined;
|
|
205
|
+
/**
|
|
206
|
+
* Represents the validity state into which the DropDownList is set.
|
|
207
|
+
*/
|
|
208
|
+
validity: FormComponentValidity;
|
|
209
|
+
/**
|
|
210
|
+
* The value of the DropDownList.
|
|
211
|
+
*/
|
|
212
|
+
value: any;
|
|
213
|
+
}
|
|
214
|
+
/** @hidden */
|
|
215
|
+
export declare type DropDownList = DropDownListHandle;
|
|
216
|
+
/**
|
|
217
|
+
* Represents the [KendoReact DropDownList component]({% slug overview_dropdownlist %}).
|
|
218
|
+
*
|
|
219
|
+
* Accepts properties of type [DropDownListProps]({% slug api_dropdowns_dropdownlistprops %}).
|
|
220
|
+
* Obtaining the `ref` returns an object of type [DropDownListHandle]({% slug api_dropdowns_dropdownlisthandle %}).
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```jsx
|
|
224
|
+
* class App extends React.Component {
|
|
225
|
+
* dropdownlist = null;
|
|
226
|
+
* render() {
|
|
227
|
+
* return (
|
|
228
|
+
* <div>
|
|
229
|
+
* <DropDownList
|
|
230
|
+
* data={[ "Albania", "Andorra", "Austria", "Belarus" ]}
|
|
231
|
+
* ref={component => this.dropdownlist = component}
|
|
232
|
+
* />
|
|
233
|
+
* <button onClick={() => alert(this.dropdownlist.value)}>alert value</button>
|
|
234
|
+
* </div>
|
|
235
|
+
* );
|
|
236
|
+
* }
|
|
237
|
+
* }
|
|
238
|
+
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
export declare const DropDownList: React.ForwardRefExoticComponent<DropDownListProps & React.RefAttributes<any>>;
|
|
@@ -24,7 +24,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
24
24
|
};
|
|
25
25
|
import * as React from 'react';
|
|
26
26
|
import * as PropTypes from 'prop-types';
|
|
27
|
-
import { classNames, Keys, getTabIndex } from '@progress/kendo-react-common';
|
|
27
|
+
import { classNames, Keys, getTabIndex, createPropsContext, withPropsContext } from '@progress/kendo-react-common';
|
|
28
28
|
import { FloatingLabel } from '@progress/kendo-react-labels';
|
|
29
29
|
import ListContainer from '../common/ListContainer';
|
|
30
30
|
import ListFilter from '../common/ListFilter';
|
|
@@ -36,30 +36,11 @@ import { validatePackage } from '@progress/kendo-react-common';
|
|
|
36
36
|
import { packageMetadata } from '../package-metadata';
|
|
37
37
|
var VALIDATION_MESSAGE = 'Please select a value from the list!';
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```jsx
|
|
43
|
-
* class App extends React.Component {
|
|
44
|
-
* dropdownlist = null;
|
|
45
|
-
* render() {
|
|
46
|
-
* return (
|
|
47
|
-
* <div>
|
|
48
|
-
* <DropDownList
|
|
49
|
-
* data={[ "Albania", "Andorra", "Austria", "Belarus" ]}
|
|
50
|
-
* ref={component => this.dropdownlist = component}
|
|
51
|
-
* />
|
|
52
|
-
* <button onClick={() => alert(this.dropdownlist.value)}>alert value</button>
|
|
53
|
-
* </div>
|
|
54
|
-
* );
|
|
55
|
-
* }
|
|
56
|
-
* }
|
|
57
|
-
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
58
|
-
* ```
|
|
39
|
+
* @hidden
|
|
59
40
|
*/
|
|
60
|
-
var
|
|
61
|
-
__extends(
|
|
62
|
-
function
|
|
41
|
+
var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
42
|
+
__extends(DropDownListWithoutContext, _super);
|
|
43
|
+
function DropDownListWithoutContext(props) {
|
|
63
44
|
var _this = _super.call(this, props) || this;
|
|
64
45
|
/**
|
|
65
46
|
* @hidden
|
|
@@ -360,7 +341,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
360
341
|
validatePackage(packageMetadata);
|
|
361
342
|
return _this;
|
|
362
343
|
}
|
|
363
|
-
Object.defineProperty(
|
|
344
|
+
Object.defineProperty(DropDownListWithoutContext.prototype, "element", {
|
|
364
345
|
/**
|
|
365
346
|
* @hidden
|
|
366
347
|
*/
|
|
@@ -370,7 +351,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
370
351
|
enumerable: true,
|
|
371
352
|
configurable: true
|
|
372
353
|
});
|
|
373
|
-
Object.defineProperty(
|
|
354
|
+
Object.defineProperty(DropDownListWithoutContext.prototype, "actionElement", {
|
|
374
355
|
/**
|
|
375
356
|
* @hidden
|
|
376
357
|
*/
|
|
@@ -380,7 +361,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
380
361
|
enumerable: true,
|
|
381
362
|
configurable: true
|
|
382
363
|
});
|
|
383
|
-
Object.defineProperty(
|
|
364
|
+
Object.defineProperty(DropDownListWithoutContext.prototype, "value", {
|
|
384
365
|
/**
|
|
385
366
|
* The value of the DropDownList.
|
|
386
367
|
*/
|
|
@@ -406,7 +387,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
406
387
|
enumerable: true,
|
|
407
388
|
configurable: true
|
|
408
389
|
});
|
|
409
|
-
Object.defineProperty(
|
|
390
|
+
Object.defineProperty(DropDownListWithoutContext.prototype, "index", {
|
|
410
391
|
/**
|
|
411
392
|
* The index of the selected item.
|
|
412
393
|
*/
|
|
@@ -419,7 +400,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
419
400
|
enumerable: true,
|
|
420
401
|
configurable: true
|
|
421
402
|
});
|
|
422
|
-
Object.defineProperty(
|
|
403
|
+
Object.defineProperty(DropDownListWithoutContext.prototype, "name", {
|
|
423
404
|
/**
|
|
424
405
|
* Gets the `name` property of the DropDownList.
|
|
425
406
|
*/
|
|
@@ -429,7 +410,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
429
410
|
enumerable: true,
|
|
430
411
|
configurable: true
|
|
431
412
|
});
|
|
432
|
-
Object.defineProperty(
|
|
413
|
+
Object.defineProperty(DropDownListWithoutContext.prototype, "validity", {
|
|
433
414
|
/**
|
|
434
415
|
* Represents the validity state into which the DropDownList is set.
|
|
435
416
|
*/
|
|
@@ -447,23 +428,23 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
447
428
|
enumerable: true,
|
|
448
429
|
configurable: true
|
|
449
430
|
});
|
|
450
|
-
Object.defineProperty(
|
|
431
|
+
Object.defineProperty(DropDownListWithoutContext.prototype, "validityStyles", {
|
|
451
432
|
get: function () {
|
|
452
433
|
return this.props.validityStyles !== undefined
|
|
453
434
|
? this.props.validityStyles
|
|
454
|
-
:
|
|
435
|
+
: DropDownListWithoutContext.defaultProps.validityStyles;
|
|
455
436
|
},
|
|
456
437
|
enumerable: true,
|
|
457
438
|
configurable: true
|
|
458
439
|
});
|
|
459
|
-
Object.defineProperty(
|
|
440
|
+
Object.defineProperty(DropDownListWithoutContext.prototype, "required", {
|
|
460
441
|
/**
|
|
461
442
|
* @hidden
|
|
462
443
|
*/
|
|
463
444
|
get: function () {
|
|
464
445
|
return this.props.required !== undefined
|
|
465
446
|
? this.props.required
|
|
466
|
-
:
|
|
447
|
+
: DropDownListWithoutContext.defaultProps.required;
|
|
467
448
|
},
|
|
468
449
|
enumerable: true,
|
|
469
450
|
configurable: true
|
|
@@ -471,7 +452,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
471
452
|
/**
|
|
472
453
|
* @hidden
|
|
473
454
|
*/
|
|
474
|
-
|
|
455
|
+
DropDownListWithoutContext.prototype.componentDidUpdate = function (prevProps, prevState) {
|
|
475
456
|
var _a = this.props, _b = _a.data, data = _b === void 0 ? [] : _b, dataItemKey = _a.dataItemKey, virtual = _a.virtual;
|
|
476
457
|
var prevTotal = prevProps.virtual ? prevProps.virtual.total : 0;
|
|
477
458
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
@@ -519,14 +500,14 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
519
500
|
/**
|
|
520
501
|
* @hidden
|
|
521
502
|
*/
|
|
522
|
-
|
|
503
|
+
DropDownListWithoutContext.prototype.componentDidMount = function () {
|
|
523
504
|
this.base.didMount();
|
|
524
505
|
this.setValidity();
|
|
525
506
|
};
|
|
526
507
|
/**
|
|
527
508
|
* @hidden
|
|
528
509
|
*/
|
|
529
|
-
|
|
510
|
+
DropDownListWithoutContext.prototype.render = function () {
|
|
530
511
|
var _this = this;
|
|
531
512
|
var _a = this.props, style = _a.style, className = _a.className, label = _a.label, dir = _a.dir, virtual = _a.virtual;
|
|
532
513
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
@@ -552,7 +533,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
552
533
|
/**
|
|
553
534
|
* @hidden
|
|
554
535
|
*/
|
|
555
|
-
|
|
536
|
+
DropDownListWithoutContext.prototype.onNavigate = function (state, keyCode) {
|
|
556
537
|
var _a = this.props, _b = _a.data, data = _b === void 0 ? [] : _b, defaultItem = _a.defaultItem, dataItemKey = _a.dataItemKey, _c = _a.virtual, virtual = _c === void 0 ? { skip: 0, total: 0, pageSize: 0 } : _c;
|
|
557
538
|
var vs = this.base.vs;
|
|
558
539
|
var value = this.value;
|
|
@@ -568,7 +549,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
568
549
|
}
|
|
569
550
|
this.applyState(state);
|
|
570
551
|
};
|
|
571
|
-
|
|
552
|
+
DropDownListWithoutContext.prototype.focusedIndex = function () {
|
|
572
553
|
var filterText = isPresent(this.props.filter) ? this.props.filter : this.state.text;
|
|
573
554
|
var _a = this.props, _b = _a.data, data = _b === void 0 ? [] : _b, _c = _a.virtual, virtual = _c === void 0 ? { skip: 0 } : _c, dataItemKey = _a.dataItemKey, textField = _a.textField, focusedItemIndex = _a.focusedItemIndex;
|
|
574
555
|
var value = this.value;
|
|
@@ -582,13 +563,13 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
582
563
|
return !hasSelected && virtual.skip === 0 ? 0 : undefined;
|
|
583
564
|
}
|
|
584
565
|
};
|
|
585
|
-
|
|
566
|
+
DropDownListWithoutContext.prototype.focusElement = function (element) {
|
|
586
567
|
var _this = this;
|
|
587
568
|
this._skipFocusEvent = true;
|
|
588
569
|
element.focus();
|
|
589
570
|
window.setTimeout(function () { return _this._skipFocusEvent = false; }, 30);
|
|
590
571
|
};
|
|
591
|
-
|
|
572
|
+
DropDownListWithoutContext.prototype.triggerOnChange = function (item, state) {
|
|
592
573
|
if (areSame(this.value, item, this.props.dataItemKey)) {
|
|
593
574
|
return;
|
|
594
575
|
}
|
|
@@ -598,18 +579,54 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
598
579
|
this._valueDuringOnChange = item;
|
|
599
580
|
state.events.push({ type: 'onChange' });
|
|
600
581
|
};
|
|
601
|
-
|
|
582
|
+
DropDownListWithoutContext.prototype.applyState = function (state) {
|
|
602
583
|
this.base.applyState(state);
|
|
603
584
|
this._valueDuringOnChange = undefined;
|
|
604
585
|
};
|
|
586
|
+
DropDownListWithoutContext.displayName = 'DropDownList';
|
|
605
587
|
/**
|
|
606
588
|
* @hidden
|
|
607
589
|
*/
|
|
608
|
-
|
|
590
|
+
DropDownListWithoutContext.propTypes = __assign({ delay: PropTypes.number, ignoreCase: PropTypes.bool, iconClassName: PropTypes.string, defaultItem: PropTypes.any, valueRender: PropTypes.func, valueMap: PropTypes.func, validationMessage: PropTypes.string, required: PropTypes.bool, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string, leftRightKeysNavigation: PropTypes.bool, title: PropTypes.string }, DropDownBase.propTypes);
|
|
609
591
|
/**
|
|
610
592
|
* @hidden
|
|
611
593
|
*/
|
|
612
|
-
|
|
613
|
-
return
|
|
594
|
+
DropDownListWithoutContext.defaultProps = __assign({ delay: 500, tabIndex: 0, ignoreCase: true }, DropDownBase.defaultProps, { required: false });
|
|
595
|
+
return DropDownListWithoutContext;
|
|
614
596
|
}(React.Component));
|
|
615
|
-
export
|
|
597
|
+
export { DropDownListWithoutContext };
|
|
598
|
+
/**
|
|
599
|
+
* Represents the PropsContext of the `DropDownList` component.
|
|
600
|
+
* Used for global configuration of all `DropDownList` instances.
|
|
601
|
+
*
|
|
602
|
+
* For more information, refer to the [Dropdowns Props Context]({% slug props-context_dropdowns %}) article.
|
|
603
|
+
*/
|
|
604
|
+
export var DropDownListPropsContext = createPropsContext();
|
|
605
|
+
/* eslint-disable @typescript-eslint/no-redeclare -- intentionally naming the component the same as the type */
|
|
606
|
+
/**
|
|
607
|
+
* Represents the [KendoReact DropDownList component]({% slug overview_dropdownlist %}).
|
|
608
|
+
*
|
|
609
|
+
* Accepts properties of type [DropDownListProps]({% slug api_dropdowns_dropdownlistprops %}).
|
|
610
|
+
* Obtaining the `ref` returns an object of type [DropDownListHandle]({% slug api_dropdowns_dropdownlisthandle %}).
|
|
611
|
+
*
|
|
612
|
+
* @example
|
|
613
|
+
* ```jsx
|
|
614
|
+
* class App extends React.Component {
|
|
615
|
+
* dropdownlist = null;
|
|
616
|
+
* render() {
|
|
617
|
+
* return (
|
|
618
|
+
* <div>
|
|
619
|
+
* <DropDownList
|
|
620
|
+
* data={[ "Albania", "Andorra", "Austria", "Belarus" ]}
|
|
621
|
+
* ref={component => this.dropdownlist = component}
|
|
622
|
+
* />
|
|
623
|
+
* <button onClick={() => alert(this.dropdownlist.value)}>alert value</button>
|
|
624
|
+
* </div>
|
|
625
|
+
* );
|
|
626
|
+
* }
|
|
627
|
+
* }
|
|
628
|
+
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
629
|
+
* ```
|
|
630
|
+
*/
|
|
631
|
+
export var DropDownList = withPropsContext(DropDownListPropsContext, DropDownListWithoutContext);
|
|
632
|
+
DropDownList.displayName = 'KendoReactDropDownList';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import DropDownList from './DropDownList';
|
|
2
|
+
import { DropDownList } from './DropDownList';
|
|
3
3
|
import { FilterChangeEvent, ChangeEvent, OpenEvent, CloseEvent, FocusEvent, BlurEvent, PageChangeEvent } from './../common/events';
|
|
4
4
|
import { VirtualizationSettings, DropDownsPopupSettings } from '../common/settings';
|
|
5
5
|
import { ListItemProps } from '../common/ListItem';
|