@progress/kendo-react-dropdowns 5.4.0-dev.202205200719 → 5.4.0-dev.202206061009
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 +16 -14
- package/dist/es/AutoComplete/AutoComplete.js +19 -15
- package/dist/es/AutoComplete/AutoCompleteProps.js +1 -0
- package/dist/es/ComboBox/ComboBox.d.ts +14 -14
- package/dist/es/ComboBox/ComboBox.js +26 -22
- package/dist/es/ComboBox/ComboBoxProps.js +1 -0
- package/dist/es/DropDownList/DropDownList.d.ts +12 -14
- package/dist/es/DropDownList/DropDownList.js +22 -18
- package/dist/es/DropDownList/DropDownListProps.js +1 -0
- package/dist/es/DropDownTree/DropDownTree.d.ts +1 -1
- package/dist/es/DropDownTree/DropDownTree.js +22 -10
- package/dist/es/DropDownTree/DropDownTreeProps.js +1 -0
- package/dist/es/MultiColumnComboBox/MultiColumnComboBox.d.ts +2 -2
- package/dist/es/MultiColumnComboBox/MultiColumnComboBox.js +10 -8
- package/dist/es/MultiSelect/MultiSelect.d.ts +14 -16
- package/dist/es/MultiSelect/MultiSelect.js +36 -23
- package/dist/es/MultiSelect/MultiSelectProps.js +1 -0
- package/dist/es/MultiSelect/TagList.d.ts +1 -0
- package/dist/es/MultiSelect/TagList.js +4 -2
- package/dist/es/MultiSelectTree/MultiSelectTree.d.ts +1 -1
- package/dist/es/MultiSelectTree/MultiSelectTree.js +21 -9
- package/dist/es/MultiSelectTree/MultiSelectTreeProps.js +1 -0
- package/dist/es/MultiSelectTree/utils.d.ts +2 -2
- package/dist/es/MultiSelectTree/utils.js +11 -2
- package/dist/es/common/ClearButton.js +3 -1
- package/dist/es/common/DropDownBase.d.ts +6 -6
- package/dist/es/common/DropDownBase.js +5 -3
- package/dist/es/common/List.d.ts +2 -2
- package/dist/es/common/List.js +4 -2
- package/dist/es/common/ListContainer.d.ts +1 -0
- package/dist/es/common/ListContainer.js +3 -1
- package/dist/es/common/ListDefaultItem.js +3 -1
- package/dist/es/common/ListFilter.js +10 -6
- package/dist/es/common/ListItem.d.ts +1 -1
- package/dist/es/common/ListItem.js +3 -1
- package/dist/es/common/Navigation.d.ts +1 -1
- package/dist/es/common/SearchBar.d.ts +2 -2
- package/dist/es/common/SearchBar.js +7 -3
- package/dist/es/common/VirtualScroll.d.ts +3 -3
- package/dist/es/common/VirtualScroll.js +6 -2
- package/dist/es/common/events.js +1 -0
- package/dist/es/common/filterDescriptor.js +1 -0
- package/dist/es/common/settings.d.ts +1 -1
- package/dist/es/common/utils.d.ts +6 -6
- package/dist/es/main.js +2 -0
- package/dist/es/messages/index.d.ts +2 -2
- package/dist/es/package-metadata.js +1 -1
- package/dist/npm/AutoComplete/AutoComplete.d.ts +16 -14
- package/dist/npm/AutoComplete/AutoComplete.js +35 -30
- package/dist/npm/ComboBox/ComboBox.d.ts +14 -14
- package/dist/npm/ComboBox/ComboBox.js +61 -56
- package/dist/npm/DropDownList/DropDownList.d.ts +12 -14
- package/dist/npm/DropDownList/DropDownList.js +49 -44
- package/dist/npm/DropDownTree/DropDownTree.d.ts +1 -1
- package/dist/npm/DropDownTree/DropDownTree.js +39 -26
- package/dist/npm/DropDownTree/ListNoData.js +3 -1
- package/dist/npm/DropDownTree/useDropdownWidth.js +1 -0
- package/dist/npm/MultiColumnComboBox/MultiColumnComboBox.d.ts +2 -2
- package/dist/npm/MultiColumnComboBox/MultiColumnComboBox.js +18 -15
- package/dist/npm/MultiSelect/MultiSelect.d.ts +14 -16
- package/dist/npm/MultiSelect/MultiSelect.js +57 -43
- package/dist/npm/MultiSelect/TagList.d.ts +1 -0
- package/dist/npm/MultiSelect/TagList.js +4 -2
- package/dist/npm/MultiSelectTree/MultiSelectTree.d.ts +1 -1
- package/dist/npm/MultiSelectTree/MultiSelectTree.js +36 -23
- package/dist/npm/MultiSelectTree/utils.d.ts +2 -2
- package/dist/npm/MultiSelectTree/utils.js +23 -11
- package/dist/npm/common/ClearButton.js +5 -3
- package/dist/npm/common/DropDownBase.d.ts +6 -6
- package/dist/npm/common/DropDownBase.js +10 -8
- package/dist/npm/common/List.d.ts +2 -2
- package/dist/npm/common/List.js +10 -8
- package/dist/npm/common/ListContainer.d.ts +1 -0
- package/dist/npm/common/ListContainer.js +3 -1
- package/dist/npm/common/ListDefaultItem.js +5 -3
- package/dist/npm/common/ListFilter.js +11 -7
- package/dist/npm/common/ListItem.d.ts +1 -1
- package/dist/npm/common/ListItem.js +5 -3
- package/dist/npm/common/MultiColumnList.js +3 -1
- package/dist/npm/common/Navigation.d.ts +1 -1
- package/dist/npm/common/Navigation.js +2 -1
- package/dist/npm/common/SearchBar.d.ts +2 -2
- package/dist/npm/common/SearchBar.js +7 -3
- package/dist/npm/common/VirtualScroll.d.ts +3 -3
- package/dist/npm/common/VirtualScroll.js +6 -2
- package/dist/npm/common/settings.d.ts +1 -1
- package/dist/npm/common/settings.js +1 -0
- package/dist/npm/common/utils.d.ts +6 -6
- package/dist/npm/common/utils.js +1 -0
- package/dist/npm/main.js +32 -18
- package/dist/npm/messages/index.d.ts +2 -2
- package/dist/npm/messages/index.js +2 -1
- package/dist/npm/package-metadata.js +2 -1
- package/dist/systemjs/kendo-react-dropdowns.js +1 -1
- package/package.json +13 -13
|
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
3
3
|
var extendStatics = function (d, b) {
|
|
4
4
|
extendStatics = Object.setPrototypeOf ||
|
|
5
5
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
7
|
return extendStatics(d, b);
|
|
8
8
|
};
|
|
9
9
|
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
10
12
|
extendStatics(d, b);
|
|
11
13
|
function __() { this.constructor = d; }
|
|
12
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -24,6 +26,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
24
26
|
return __assign.apply(this, arguments);
|
|
25
27
|
};
|
|
26
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.DropDownList = exports.DropDownListPropsContext = exports.DropDownListWithoutContext = void 0;
|
|
27
30
|
var React = require("react");
|
|
28
31
|
var PropTypes = require("prop-types");
|
|
29
32
|
var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
@@ -49,8 +52,10 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
49
52
|
* @hidden
|
|
50
53
|
*/
|
|
51
54
|
_this.state = {};
|
|
55
|
+
_this._element = null;
|
|
52
56
|
_this.base = new DropDownBase_1.default(_this);
|
|
53
57
|
_this.searchState = { word: '', last: '' };
|
|
58
|
+
_this._select = null;
|
|
54
59
|
_this._skipFocusEvent = false;
|
|
55
60
|
_this._filterInput = null;
|
|
56
61
|
_this._navigated = false;
|
|
@@ -70,7 +75,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
70
75
|
var skip = virtual ? virtual.skip : 0;
|
|
71
76
|
var item = (index === -1 && defaultItem !== undefined) ?
|
|
72
77
|
defaultItem : data[index - skip];
|
|
73
|
-
var newSelected = !utils_1.areSame(item, _this.value, dataItemKey);
|
|
78
|
+
var newSelected = !(0, utils_1.areSame)(item, _this.value, dataItemKey);
|
|
74
79
|
_this.triggerOnChange(item, state);
|
|
75
80
|
if (newSelected) {
|
|
76
81
|
_this.base.triggerPageChangeCornerItems(item, state);
|
|
@@ -96,8 +101,8 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
96
101
|
dir: dir !== undefined ? dir : base.dirCalculated,
|
|
97
102
|
width: popupWidth,
|
|
98
103
|
popupSettings: {
|
|
99
|
-
popupClass: kendo_react_common_1.classNames(popupSettings.popupClass, 'k-list', (_a = {},
|
|
100
|
-
_a["k-list-"
|
|
104
|
+
popupClass: (0, kendo_react_common_1.classNames)(popupSettings.popupClass, 'k-list', (_a = {},
|
|
105
|
+
_a["k-list-".concat(sizeMap[size] || size)] = size,
|
|
101
106
|
_a['k-virtual-list'] = _this.base.vs.enabled,
|
|
102
107
|
_a)),
|
|
103
108
|
className: popupSettings.className,
|
|
@@ -123,7 +128,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
123
128
|
var skip = virtual.skip;
|
|
124
129
|
var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
|
|
125
130
|
var popupSettings = _this.base.getPopupSettings();
|
|
126
|
-
var translate = "translateY("
|
|
131
|
+
var translate = "translateY(".concat(vs.translate, "px)");
|
|
127
132
|
return (React.createElement(List_1.default, { id: _this.base.listBoxId, show: opened, data: data.slice(), focusedIndex: _this.focusedIndex(), value: _this.value, textField: textField, valueField: dataItemKey, optionsGuid: _this.base.guid, listRef: function (list) { return vs.list = _this.base.list = list; }, wrapperStyle: { maxHeight: popupSettings.height }, wrapperCssClass: "k-list-content", listStyle: vs.enabled ? { transform: translate } : undefined, key: "listkey", skip: skip, onClick: _this.handleItemClick, itemRender: itemRender, noDataRender: listNoDataRender, onScroll: function (e) {
|
|
128
133
|
vs.scrollHandler(e);
|
|
129
134
|
}, wrapperRef: vs.scrollerRef, scroller: _this.base.renderScrollElement() }));
|
|
@@ -134,7 +139,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
134
139
|
};
|
|
135
140
|
_this.renderDefaultItem = function () {
|
|
136
141
|
var _a = _this.props, textField = _a.textField, defaultItem = _a.defaultItem, dataItemKey = _a.dataItemKey;
|
|
137
|
-
return defaultItem !== undefined && (React.createElement(ListDefaultItem_1.default, { defaultItem: defaultItem, textField: textField, selected: utils_1.areSame(_this.value, defaultItem, dataItemKey), key: "defaultitemkey", onClick: _this.handleDefaultItemClick }));
|
|
142
|
+
return defaultItem !== undefined && (React.createElement(ListDefaultItem_1.default, { defaultItem: defaultItem, textField: textField, selected: (0, utils_1.areSame)(_this.value, defaultItem, dataItemKey), key: "defaultitemkey", onClick: _this.handleDefaultItemClick }));
|
|
138
143
|
};
|
|
139
144
|
_this.search = function (event) {
|
|
140
145
|
clearTimeout(_this._typingTimeout);
|
|
@@ -150,9 +155,9 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
150
155
|
});
|
|
151
156
|
var word = _this.searchState.word;
|
|
152
157
|
var last = _this.searchState.last;
|
|
153
|
-
var isInLoop = utils_1.sameCharsOnly(word, last);
|
|
158
|
+
var isInLoop = (0, utils_1.sameCharsOnly)(word, last);
|
|
154
159
|
var dataLength = mappedData.length;
|
|
155
|
-
var startIndex = Math.max(0, data.findIndex(function (i) { return utils_1.areSame(i, _this.value, dataItemKey); }));
|
|
160
|
+
var startIndex = Math.max(0, data.findIndex(function (i) { return (0, utils_1.areSame)(i, _this.value, dataItemKey); }));
|
|
156
161
|
var defaultItem;
|
|
157
162
|
if (_this.props.defaultItem) {
|
|
158
163
|
defaultItem = { item: _this.props.defaultItem, itemIndex: -1 };
|
|
@@ -160,13 +165,13 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
160
165
|
startIndex += 1;
|
|
161
166
|
}
|
|
162
167
|
startIndex += isInLoop ? 1 : 0;
|
|
163
|
-
mappedData = utils_1.shuffleData(mappedData, startIndex, defaultItem);
|
|
168
|
+
mappedData = (0, utils_1.shuffleData)(mappedData, startIndex, defaultItem);
|
|
164
169
|
var text, loopMatch, nextMatch, index = 0;
|
|
165
170
|
var _c = _this.props, textField = _c.textField, ignoreCase = _c.ignoreCase;
|
|
166
171
|
for (; index < dataLength; index++) {
|
|
167
|
-
text = utils_1.getItemValue(mappedData[index].item, textField);
|
|
168
|
-
loopMatch = isInLoop && utils_1.matchText(text, last, ignoreCase);
|
|
169
|
-
nextMatch = utils_1.matchText(text, word, ignoreCase);
|
|
172
|
+
text = (0, utils_1.getItemValue)(mappedData[index].item, textField);
|
|
173
|
+
loopMatch = isInLoop && (0, utils_1.matchText)(text, last, ignoreCase);
|
|
174
|
+
nextMatch = (0, utils_1.matchText)(text, word, ignoreCase);
|
|
170
175
|
if (loopMatch || nextMatch) {
|
|
171
176
|
index = mappedData[index].itemIndex;
|
|
172
177
|
break;
|
|
@@ -324,7 +329,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
324
329
|
: _this.props.validationMessage || VALIDATION_MESSAGE);
|
|
325
330
|
}
|
|
326
331
|
};
|
|
327
|
-
kendo_react_common_2.validatePackage(package_metadata_1.packageMetadata);
|
|
332
|
+
(0, kendo_react_common_2.validatePackage)(package_metadata_1.packageMetadata);
|
|
328
333
|
return _this;
|
|
329
334
|
}
|
|
330
335
|
Object.defineProperty(DropDownListWithoutContext.prototype, "element", {
|
|
@@ -334,7 +339,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
334
339
|
get: function () {
|
|
335
340
|
return this._element;
|
|
336
341
|
},
|
|
337
|
-
enumerable:
|
|
342
|
+
enumerable: false,
|
|
338
343
|
configurable: true
|
|
339
344
|
});
|
|
340
345
|
Object.defineProperty(DropDownListWithoutContext.prototype, "value", {
|
|
@@ -355,12 +360,12 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
355
360
|
else if (this.props.defaultValue !== undefined) {
|
|
356
361
|
value = this.props.defaultValue;
|
|
357
362
|
}
|
|
358
|
-
if (!utils_1.isPresent(value) && this.props.defaultItem !== undefined) {
|
|
363
|
+
if (!(0, utils_1.isPresent)(value) && this.props.defaultItem !== undefined) {
|
|
359
364
|
value = this.props.defaultItem;
|
|
360
365
|
}
|
|
361
366
|
return value;
|
|
362
367
|
},
|
|
363
|
-
enumerable:
|
|
368
|
+
enumerable: false,
|
|
364
369
|
configurable: true
|
|
365
370
|
});
|
|
366
371
|
Object.defineProperty(DropDownListWithoutContext.prototype, "index", {
|
|
@@ -371,9 +376,9 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
371
376
|
var _a = this.props, _b = _a.data, data = _b === void 0 ? [] : _b, dataItemKey = _a.dataItemKey;
|
|
372
377
|
var value = this.value;
|
|
373
378
|
// TO DO: deprecate it!
|
|
374
|
-
return data.findIndex(function (i) { return utils_1.areSame(i, value, dataItemKey); });
|
|
379
|
+
return data.findIndex(function (i) { return (0, utils_1.areSame)(i, value, dataItemKey); });
|
|
375
380
|
},
|
|
376
|
-
enumerable:
|
|
381
|
+
enumerable: false,
|
|
377
382
|
configurable: true
|
|
378
383
|
});
|
|
379
384
|
Object.defineProperty(DropDownListWithoutContext.prototype, "name", {
|
|
@@ -383,7 +388,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
383
388
|
get: function () {
|
|
384
389
|
return this.props.name;
|
|
385
390
|
},
|
|
386
|
-
enumerable:
|
|
391
|
+
enumerable: false,
|
|
387
392
|
configurable: true
|
|
388
393
|
});
|
|
389
394
|
Object.defineProperty(DropDownListWithoutContext.prototype, "validity", {
|
|
@@ -401,7 +406,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
401
406
|
valueMissing: this.value === null
|
|
402
407
|
};
|
|
403
408
|
},
|
|
404
|
-
enumerable:
|
|
409
|
+
enumerable: false,
|
|
405
410
|
configurable: true
|
|
406
411
|
});
|
|
407
412
|
Object.defineProperty(DropDownListWithoutContext.prototype, "validityStyles", {
|
|
@@ -410,7 +415,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
410
415
|
? this.props.validityStyles
|
|
411
416
|
: DropDownListWithoutContext.defaultProps.validityStyles;
|
|
412
417
|
},
|
|
413
|
-
enumerable:
|
|
418
|
+
enumerable: false,
|
|
414
419
|
configurable: true
|
|
415
420
|
});
|
|
416
421
|
Object.defineProperty(DropDownListWithoutContext.prototype, "required", {
|
|
@@ -422,7 +427,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
422
427
|
? this.props.required
|
|
423
428
|
: DropDownListWithoutContext.defaultProps.required;
|
|
424
429
|
},
|
|
425
|
-
enumerable:
|
|
430
|
+
enumerable: false,
|
|
426
431
|
configurable: true
|
|
427
432
|
});
|
|
428
433
|
/**
|
|
@@ -450,8 +455,8 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
450
455
|
else {
|
|
451
456
|
var selectedItem_1 = this.value;
|
|
452
457
|
var prevSelectedItem = prevProps.value !== undefined ? prevProps.value : prevState.value;
|
|
453
|
-
var selectedItemIndex = data.findIndex(function (i) { return utils_1.areSame(i, selectedItem_1, dataItemKey); });
|
|
454
|
-
var selectedItemChanged = !utils_1.areSame(prevSelectedItem, selectedItem_1, dataItemKey);
|
|
458
|
+
var selectedItemIndex = data.findIndex(function (i) { return (0, utils_1.areSame)(i, selectedItem_1, dataItemKey); });
|
|
459
|
+
var selectedItemChanged = !(0, utils_1.areSame)(prevSelectedItem, selectedItem_1, dataItemKey);
|
|
455
460
|
if (opening && virtual) {
|
|
456
461
|
this.base.scrollToVirtualItem(virtual, selectedItemIndex);
|
|
457
462
|
}
|
|
@@ -488,7 +493,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
488
493
|
var _c = this.props, style = _c.style, className = _c.className, label = _c.label, dir = _c.dir, virtual = _c.virtual, size = _c.size, rounded = _c.rounded, fillMode = _c.fillMode;
|
|
489
494
|
var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
|
|
490
495
|
var value = this.value;
|
|
491
|
-
var text = utils_1.getItemValue(value, this.props.textField);
|
|
496
|
+
var text = (0, utils_1.getItemValue)(value, this.props.textField);
|
|
492
497
|
var isValid = !this.validityStyles || this.validity.valid;
|
|
493
498
|
var base = this.base;
|
|
494
499
|
var vs = base.vs;
|
|
@@ -500,15 +505,15 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
500
505
|
}
|
|
501
506
|
var _d = this.props, dataItemKey = _d.dataItemKey, _e = _d.data, data = _e === void 0 ? [] : _e, disabled = _d.disabled, tabIndex = _d.tabIndex, loading = _d.loading, iconClassName = _d.iconClassName, valueRender = _d.valueRender;
|
|
502
507
|
var focused = this.state.focused;
|
|
503
|
-
var selectedIndex = data.findIndex(function (i) { return utils_1.areSame(i, value, dataItemKey); });
|
|
508
|
+
var selectedIndex = data.findIndex(function (i) { return (0, utils_1.areSame)(i, value, dataItemKey); });
|
|
504
509
|
var valueDefaultRendering = (React.createElement("span", { className: "k-input-inner" },
|
|
505
510
|
React.createElement("span", { className: "k-input-value-text" }, text)));
|
|
506
511
|
var valueElement = valueRender !== undefined ?
|
|
507
512
|
valueRender.call(undefined, valueDefaultRendering, value) : valueDefaultRendering;
|
|
508
|
-
var dropdownlist = (React.createElement("span", { ref: this.componentRef, className: kendo_react_common_1.classNames('k-dropdownlist k-picker', className, (_a = {},
|
|
509
|
-
_a["k-picker-"
|
|
510
|
-
_a["k-rounded-"
|
|
511
|
-
_a["k-picker-"
|
|
513
|
+
var dropdownlist = (React.createElement("span", { ref: this.componentRef, className: (0, kendo_react_common_1.classNames)('k-dropdownlist k-picker', className, (_a = {},
|
|
514
|
+
_a["k-picker-".concat(sizeMap[size] || size)] = size,
|
|
515
|
+
_a["k-rounded-".concat(roundedMap[rounded] || rounded)] = rounded,
|
|
516
|
+
_a["k-picker-".concat(fillMode)] = fillMode,
|
|
512
517
|
_a['k-focus'] = focused,
|
|
513
518
|
_a['k-disabled'] = disabled,
|
|
514
519
|
_a['k-invalid'] = !isValid,
|
|
@@ -516,15 +521,15 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
516
521
|
_a['k-required'] = this.required,
|
|
517
522
|
_a)), style: !label
|
|
518
523
|
? style
|
|
519
|
-
: __assign({}, style, { width: undefined }), dir: dir, onMouseDown: opened ? utils_1.preventDefaultNonInputs : undefined, onFocus: this.handleFocus, onBlur: this.handleBlur, tabIndex: kendo_react_common_1.getTabIndex(tabIndex, disabled), accessKey: this.props.accessKey, onKeyDown: this.handleKeyDown, onKeyPress: this.handleKeyPress, onClick: disabled ? undefined : this.handleWrapperClick, role: 'listbox', "aria-disabled": disabled || undefined, "aria-haspopup": true, "aria-expanded": opened || false, "aria-owns": this.base.listBoxId, "aria-activedescendant": opened ? ('option-' + this.base.guid + '-' + (selectedIndex + (virtual ? virtual.skip : 0))) : undefined, "aria-label": this.props.ariaLabel || this.props.label, "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, id: this.props.id, title: this.props.title },
|
|
524
|
+
: __assign(__assign({}, style), { width: undefined }), dir: dir, onMouseDown: opened ? utils_1.preventDefaultNonInputs : undefined, onFocus: this.handleFocus, onBlur: this.handleBlur, tabIndex: (0, kendo_react_common_1.getTabIndex)(tabIndex, disabled), accessKey: this.props.accessKey, onKeyDown: this.handleKeyDown, onKeyPress: this.handleKeyPress, onClick: disabled ? undefined : this.handleWrapperClick, role: 'listbox', "aria-required": this.required, "aria-disabled": disabled || undefined, "aria-haspopup": true, "aria-expanded": opened || false, "aria-owns": this.base.listBoxId, "aria-activedescendant": opened ? ('option-' + this.base.guid + '-' + (selectedIndex + (virtual ? virtual.skip : 0))) : undefined, "aria-label": this.props.ariaLabel || this.props.label, "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, id: this.props.id, title: this.props.title },
|
|
520
525
|
valueElement,
|
|
521
526
|
loading && React.createElement("span", { className: "k-icon k-i-loading k-input-loading-icon", key: "loading" }),
|
|
522
|
-
React.createElement("button", { tabIndex: -1, type: "button", "aria-hidden": true, className: kendo_react_common_1.classNames('k-input-button k-button k-icon-button', (_b = {},
|
|
523
|
-
_b["k-button-"
|
|
524
|
-
_b["k-button-"
|
|
525
|
-
_b["k-button-"
|
|
527
|
+
React.createElement("button", { tabIndex: -1, type: "button", "aria-hidden": true, className: (0, kendo_react_common_1.classNames)('k-input-button k-button k-icon-button', (_b = {},
|
|
528
|
+
_b["k-button-".concat(sizeMap[size] || size)] = size,
|
|
529
|
+
_b["k-button-".concat(fillMode)] = fillMode,
|
|
530
|
+
_b["k-button-".concat(fillMode, "-base")] = fillMode,
|
|
526
531
|
_b)), onMouseDown: function (e) { return e.preventDefault(); } },
|
|
527
|
-
React.createElement("span", { className: kendo_react_common_1.classNames('k-button-icon k-icon k-i-arrow-s', iconClassName) })),
|
|
532
|
+
React.createElement("span", { className: (0, kendo_react_common_1.classNames)('k-button-icon k-icon k-i-arrow-s', iconClassName) })),
|
|
528
533
|
this.dummySelect(value),
|
|
529
534
|
this.renderListContainer()));
|
|
530
535
|
return label ? (React.createElement(kendo_react_labels_1.FloatingLabel, { label: label, editorValue: text, editorValid: isValid, editorDisabled: this.props.disabled, style: { width: style ? style.width : undefined }, children: dropdownlist })) : dropdownlist;
|
|
@@ -536,7 +541,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
536
541
|
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;
|
|
537
542
|
var vs = this.base.vs;
|
|
538
543
|
var value = this.value;
|
|
539
|
-
var index = data.findIndex(function (i) { return utils_1.areSame(i, value, dataItemKey); });
|
|
544
|
+
var index = data.findIndex(function (i) { return (0, utils_1.areSame)(i, value, dataItemKey); });
|
|
540
545
|
var newIndex = this.base.navigation.navigate({
|
|
541
546
|
current: virtual.skip + index,
|
|
542
547
|
max: (vs.enabled ? virtual.total : data.length) - 1,
|
|
@@ -549,14 +554,14 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
549
554
|
this.applyState(state);
|
|
550
555
|
};
|
|
551
556
|
DropDownListWithoutContext.prototype.focusedIndex = function () {
|
|
552
|
-
var filterText = utils_1.isPresent(this.props.filter) ? this.props.filter : this.state.text;
|
|
557
|
+
var filterText = (0, utils_1.isPresent)(this.props.filter) ? this.props.filter : this.state.text;
|
|
553
558
|
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;
|
|
554
559
|
var value = this.value;
|
|
555
|
-
var selectedIndex = data.findIndex(function (i) { return utils_1.areSame(i, value, dataItemKey); });
|
|
560
|
+
var selectedIndex = data.findIndex(function (i) { return (0, utils_1.areSame)(i, value, dataItemKey); });
|
|
556
561
|
var hasSelected = !(selectedIndex < 0 && !this.props.defaultItem);
|
|
557
562
|
if (!hasSelected && filterText && virtual.skip === 0) {
|
|
558
563
|
return focusedItemIndex ? focusedItemIndex(data, filterText, textField) :
|
|
559
|
-
data.indexOf(utils_1.getFocusedItem(data, filterText, textField));
|
|
564
|
+
data.indexOf((0, utils_1.getFocusedItem)(data, filterText, textField));
|
|
560
565
|
}
|
|
561
566
|
else {
|
|
562
567
|
return !hasSelected && virtual.skip === 0 ? 0 : undefined;
|
|
@@ -569,7 +574,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
569
574
|
window.setTimeout(function () { return _this._skipFocusEvent = false; }, 30);
|
|
570
575
|
};
|
|
571
576
|
DropDownListWithoutContext.prototype.triggerOnChange = function (item, state) {
|
|
572
|
-
if (utils_1.areSame(this.value, item, this.props.dataItemKey)) {
|
|
577
|
+
if ((0, utils_1.areSame)(this.value, item, this.props.dataItemKey)) {
|
|
573
578
|
return;
|
|
574
579
|
}
|
|
575
580
|
if (this.props.value === undefined) {
|
|
@@ -590,7 +595,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
|
|
|
590
595
|
/**
|
|
591
596
|
* @hidden
|
|
592
597
|
*/
|
|
593
|
-
DropDownListWithoutContext.defaultProps = __assign({ delay: 500, tabIndex: 0, ignoreCase: true }, DropDownBase_1.default.defaultProps, { required: false, size: 'medium', rounded: 'medium', fillMode: 'solid' });
|
|
598
|
+
DropDownListWithoutContext.defaultProps = __assign(__assign({ delay: 500, tabIndex: 0, ignoreCase: true }, DropDownBase_1.default.defaultProps), { required: false, size: 'medium', rounded: 'medium', fillMode: 'solid' });
|
|
594
599
|
return DropDownListWithoutContext;
|
|
595
600
|
}(React.Component));
|
|
596
601
|
exports.DropDownListWithoutContext = DropDownListWithoutContext;
|
|
@@ -600,7 +605,7 @@ exports.DropDownListWithoutContext = DropDownListWithoutContext;
|
|
|
600
605
|
*
|
|
601
606
|
* For more information, refer to the [Dropdowns Props Context]({% slug props-context_dropdowns %}) article.
|
|
602
607
|
*/
|
|
603
|
-
exports.DropDownListPropsContext = kendo_react_common_1.createPropsContext();
|
|
608
|
+
exports.DropDownListPropsContext = (0, kendo_react_common_1.createPropsContext)();
|
|
604
609
|
/* eslint-disable @typescript-eslint/no-redeclare -- intentionally naming the component the same as the type */
|
|
605
610
|
/**
|
|
606
611
|
* Represents the [KendoReact DropDownList component]({% slug overview_dropdownlist %}).
|
|
@@ -627,5 +632,5 @@ exports.DropDownListPropsContext = kendo_react_common_1.createPropsContext();
|
|
|
627
632
|
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
628
633
|
* ```
|
|
629
634
|
*/
|
|
630
|
-
exports.DropDownList = kendo_react_common_1.withPropsContext(exports.DropDownListPropsContext, DropDownListWithoutContext);
|
|
635
|
+
exports.DropDownList = (0, kendo_react_common_1.withPropsContext)(exports.DropDownListPropsContext, DropDownListWithoutContext);
|
|
631
636
|
exports.DropDownList.displayName = 'KendoReactDropDownList';
|
|
@@ -13,4 +13,4 @@ export declare const DropDownTreePropsContext: React.Context<(p: DropDownTreePro
|
|
|
13
13
|
* Accepts properties of type [DropDownTreeProps]({% slug api_dropdowns_dropdowntreeprops %}).
|
|
14
14
|
* Obtaining the `ref` returns an object of type [DropDownTreeHandle]({% slug api_dropdowns_dropdowntreehandle %}).
|
|
15
15
|
*/
|
|
16
|
-
export declare const DropDownTree: React.ForwardRefExoticComponent<DropDownTreeProps & React.RefAttributes<DropDownTreeHandle>>;
|
|
16
|
+
export declare const DropDownTree: React.ForwardRefExoticComponent<DropDownTreeProps & React.RefAttributes<DropDownTreeHandle | null>>;
|
|
@@ -10,7 +10,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
13
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.DropDownTree = exports.DropDownTreePropsContext = void 0;
|
|
14
24
|
var React = require("react");
|
|
15
25
|
var PropTypes = require("prop-types");
|
|
16
26
|
var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
@@ -61,7 +71,7 @@ var defaultProps = {
|
|
|
61
71
|
*
|
|
62
72
|
* For more information, refer to the [Dropdowns Props Context]({% slug props-context_dropdowns %}) article.
|
|
63
73
|
*/
|
|
64
|
-
exports.DropDownTreePropsContext = kendo_react_common_1.createPropsContext();
|
|
74
|
+
exports.DropDownTreePropsContext = (0, kendo_react_common_1.createPropsContext)();
|
|
65
75
|
/**
|
|
66
76
|
* Represents the DropDownTree component.
|
|
67
77
|
*
|
|
@@ -70,12 +80,12 @@ exports.DropDownTreePropsContext = kendo_react_common_1.createPropsContext();
|
|
|
70
80
|
*/
|
|
71
81
|
exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
72
82
|
var _a, _b;
|
|
73
|
-
kendo_react_common_2.validatePackage(package_metadata_1.packageMetadata);
|
|
74
|
-
var props = kendo_react_common_1.usePropsContext(exports.DropDownTreePropsContext, directProps);
|
|
75
|
-
var calculatedId = React.useMemo(function () { return kendo_react_common_1.guid(); }, []);
|
|
83
|
+
(0, kendo_react_common_2.validatePackage)(package_metadata_1.packageMetadata);
|
|
84
|
+
var props = (0, kendo_react_common_1.usePropsContext)(exports.DropDownTreePropsContext, directProps);
|
|
85
|
+
var calculatedId = React.useMemo(function () { return (0, kendo_react_common_1.guid)(); }, []);
|
|
76
86
|
var id = props.id || calculatedId;
|
|
77
87
|
var _c = props.data, data = _c === void 0 ? [] : _c, dataItemKey = props.dataItemKey, _d = props.popupSettings, popupSettings = _d === void 0 ? {} : _d, _e = props.style, style = _e === void 0 ? {} : _e, opened = props.opened, disabled = props.disabled, _f = props.onOpen, onOpen = _f === void 0 ? kendo_react_common_1.noop : _f, _g = props.onClose, onClose = _g === void 0 ? kendo_react_common_1.noop : _g, placeholder = props.placeholder, label = props.label, name = props.name, _h = props.selectField, selectField = _h === void 0 ? defaultProps.selectField : _h, _j = props.subItemsField, subItemsField = _j === void 0 ? defaultProps.subItemsField : _j, validationMessage = props.validationMessage, valid = props.valid, required = props.required, validityStyles = props.validityStyles;
|
|
78
|
-
var tabIndex = kendo_react_common_1.getTabIndex(props.tabIndex, disabled);
|
|
88
|
+
var tabIndex = (0, kendo_react_common_1.getTabIndex)(props.tabIndex, disabled);
|
|
79
89
|
var target = React.useRef(null);
|
|
80
90
|
var elementRef = React.useRef(null);
|
|
81
91
|
var inputRef = React.useRef(null);
|
|
@@ -85,8 +95,8 @@ exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
|
85
95
|
var _k = React.useState(undefined), stateValue = _k[0], setStateValue = _k[1];
|
|
86
96
|
var controlled = props.value !== undefined;
|
|
87
97
|
var value = controlled ? props.value : (stateValue !== undefined ? stateValue : props.defaultValue);
|
|
88
|
-
var hasValue = utils_1.isPresent(value);
|
|
89
|
-
var currentValueText = hasValue ? utils_1.getItemValue(value, props.textField) : '';
|
|
98
|
+
var hasValue = (0, utils_1.isPresent)(value);
|
|
99
|
+
var currentValueText = hasValue ? (0, utils_1.getItemValue)(value, props.textField) : '';
|
|
90
100
|
var validity = getValidity({ validationMessage: validationMessage, valid: valid, required: required }, hasValue);
|
|
91
101
|
var focus = React.useCallback(function () { return elementRef.current && elementRef.current.focus(); }, []);
|
|
92
102
|
React.useImperativeHandle(target, function () { return ({
|
|
@@ -95,10 +105,10 @@ exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
|
95
105
|
focus: focus
|
|
96
106
|
}); });
|
|
97
107
|
React.useImperativeHandle(ref, function () { return target.current; });
|
|
98
|
-
var dir = kendo_react_common_1.useRtl(elementRef, props.dir);
|
|
108
|
+
var dir = (0, kendo_react_common_1.useRtl)(elementRef, props.dir);
|
|
99
109
|
var initialStyleWidth = popupSettings.width !== undefined ?
|
|
100
110
|
popupSettings.width : (style.width !== undefined ? style.width : defaultProps.popupSettings.width);
|
|
101
|
-
var popupWidth = useDropdownWidth_1.useDropdownWidth(elementRef, initialStyleWidth);
|
|
111
|
+
var popupWidth = (0, useDropdownWidth_1.useDropdownWidth)(elementRef, initialStyleWidth);
|
|
102
112
|
var popupStyles = __assign({ width: popupWidth }, (dir !== undefined ? { direction: dir } : {}));
|
|
103
113
|
var _l = React.useState(false), open = _l[0], setOpen = _l[1];
|
|
104
114
|
var isOpen = opened !== undefined ? opened : open;
|
|
@@ -172,7 +182,7 @@ exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
|
172
182
|
keyCode === kendo_react_common_1.Keys.home || keyCode === kendo_react_common_1.Keys.end)) {
|
|
173
183
|
if (keyCode === kendo_react_common_1.Keys.up && inputRef.current) {
|
|
174
184
|
var items = Array.from(treeview.querySelectorAll('.k-treeview-item'));
|
|
175
|
-
var focusedItem = items
|
|
185
|
+
var focusedItem = __spreadArray([], items, true).reverse().find(function (i) { return Boolean(i && i.querySelector('.k-focus')); });
|
|
176
186
|
if (focusedItem && items.indexOf(focusedItem) === 0) {
|
|
177
187
|
return switchFocus(function () { focusElement(inputRef.current); });
|
|
178
188
|
}
|
|
@@ -268,7 +278,7 @@ exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
|
268
278
|
}
|
|
269
279
|
}, [props.onChange, controlled]);
|
|
270
280
|
var onChange = React.useCallback(function (event) {
|
|
271
|
-
if (utils_1.areSame(event.item, value, dataItemKey) || !target.current) {
|
|
281
|
+
if ((0, utils_1.areSame)(event.item, value, dataItemKey) || !target.current) {
|
|
272
282
|
return;
|
|
273
283
|
}
|
|
274
284
|
var item = event.item, itemHierarchicalIndex = event.itemHierarchicalIndex, nativeEvent = event.nativeEvent, syntheticEvent = event.syntheticEvent;
|
|
@@ -299,7 +309,10 @@ exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
|
299
309
|
var item = event.item, itemHierarchicalIndex = event.itemHierarchicalIndex, nativeEvent = event.nativeEvent, syntheticEvent = event.syntheticEvent;
|
|
300
310
|
var expandEvent = {
|
|
301
311
|
level: toLevel(itemHierarchicalIndex),
|
|
302
|
-
item: item,
|
|
312
|
+
item: item,
|
|
313
|
+
nativeEvent: nativeEvent,
|
|
314
|
+
syntheticEvent: syntheticEvent,
|
|
315
|
+
target: target.current
|
|
303
316
|
};
|
|
304
317
|
props.onExpandChange.call(undefined, expandEvent);
|
|
305
318
|
}
|
|
@@ -321,40 +334,40 @@ exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
|
321
334
|
}, [props.onFilterChange, props.filter, props.textField]);
|
|
322
335
|
var treeViewData = React.useMemo(function () {
|
|
323
336
|
return (controlled || !hasValue) ? data :
|
|
324
|
-
kendo_react_common_1.mapTree(data, subItemsField, function (item) {
|
|
337
|
+
(0, kendo_react_common_1.mapTree)(data, subItemsField, function (item) {
|
|
325
338
|
var _a;
|
|
326
|
-
return kendo_react_common_1.extendDataItem(item, subItemsField, (_a = {}, _a[selectField] = utils_1.areSame(item, value, dataItemKey), _a));
|
|
339
|
+
return (0, kendo_react_common_1.extendDataItem)(item, subItemsField, (_a = {}, _a[selectField] = (0, utils_1.areSame)(item, value, dataItemKey), _a));
|
|
327
340
|
});
|
|
328
341
|
}, [data, value, controlled, hasValue, selectField, subItemsField]);
|
|
329
342
|
var NoData = props.listNoData || ListNoData_1.ListNoData;
|
|
330
343
|
var ValueComponent = props.valueHolder || ValueHolder;
|
|
331
|
-
var localization = kendo_react_intl_1.useLocalization();
|
|
344
|
+
var localization = (0, kendo_react_intl_1.useLocalization)();
|
|
332
345
|
var isValid = !validityStyles || validity.valid;
|
|
333
346
|
var size = props.size, rounded = props.rounded, fillMode = props.fillMode;
|
|
334
|
-
var dropdowntree = (React.createElement("span", { className: kendo_react_common_1.classNames('k-dropdowntree k-picker', props.className, (_a = {},
|
|
335
|
-
_a["k-picker-"
|
|
336
|
-
_a["k-rounded-"
|
|
337
|
-
_a["k-picker-"
|
|
347
|
+
var dropdowntree = (React.createElement("span", { className: (0, kendo_react_common_1.classNames)('k-dropdowntree k-picker', props.className, (_a = {},
|
|
348
|
+
_a["k-picker-".concat(sizeMap[size] || size)] = size,
|
|
349
|
+
_a["k-rounded-".concat(roundedMap[rounded] || rounded)] = rounded,
|
|
350
|
+
_a["k-picker-".concat(fillMode)] = fillMode,
|
|
338
351
|
_a['k-focus'] = focused,
|
|
339
352
|
_a['k-invalid'] = !isValid,
|
|
340
353
|
_a['k-loading'] = props.loading,
|
|
341
354
|
_a['k-required'] = required,
|
|
342
355
|
_a['k-disabled'] = props.disabled,
|
|
343
|
-
_a)), tabIndex: tabIndex, accessKey: props.accessKey, id: id, style: label ? __assign({}, style, { width: undefined }) : style, dir: dir, ref: elementRef, onKeyDown: disabled ? undefined : onWrapperKeyDown, onMouseDown: onWrapperMouseDown, onClick: disabled ? undefined : onWrapperClick, onFocus: onFocus, onBlur: onBlur, role: "listbox", "aria-haspopup": "true", "aria-expanded": isOpen, "aria-disabled": disabled, "aria-label": label, "aria-labelledby": props.ariaLabelledBy, "aria-describedby": props.ariaDescribedBy },
|
|
356
|
+
_a)), tabIndex: tabIndex, accessKey: props.accessKey, id: id, style: label ? __assign(__assign({}, style), { width: undefined }) : style, dir: dir, ref: elementRef, onKeyDown: disabled ? undefined : onWrapperKeyDown, onMouseDown: onWrapperMouseDown, onClick: disabled ? undefined : onWrapperClick, onFocus: onFocus, onBlur: onBlur, role: "listbox", "aria-haspopup": "true", "aria-expanded": isOpen, "aria-disabled": disabled, "aria-label": label, "aria-labelledby": props.ariaLabelledBy, "aria-describedby": props.ariaDescribedBy },
|
|
344
357
|
React.createElement("span", { className: "k-input-inner" },
|
|
345
358
|
React.createElement(ValueComponent, { item: value }, currentValueText || placeholder)),
|
|
346
359
|
props.loading && React.createElement("span", { className: "k-icon k-i-loading k-input-loading-icon" }),
|
|
347
360
|
hasValue && !disabled && (React.createElement("span", { onClick: onClear, className: "k-clear-value", title: localization.toLanguageString(messages_1.clear, messages_1.messages[messages_1.clear]), role: "button", tabIndex: -1, onMouseDown: function (e) { return e.preventDefault(); } },
|
|
348
361
|
React.createElement("span", { className: "k-icon k-i-x" }))),
|
|
349
|
-
React.createElement("button", { tabIndex: -1, type: "button", "aria-label": "select", className: kendo_react_common_1.classNames('k-input-button k-button k-icon-button', (_b = {},
|
|
350
|
-
_b["k-button-"
|
|
351
|
-
_b["k-button-"
|
|
352
|
-
_b["k-button-"
|
|
362
|
+
React.createElement("button", { tabIndex: -1, type: "button", "aria-label": "select", className: (0, kendo_react_common_1.classNames)('k-input-button k-button k-icon-button', (_b = {},
|
|
363
|
+
_b["k-button-".concat(sizeMap[size] || size)] = size,
|
|
364
|
+
_b["k-button-".concat(fillMode)] = fillMode,
|
|
365
|
+
_b["k-button-".concat(fillMode, "-base")] = fillMode,
|
|
353
366
|
_b)) },
|
|
354
367
|
React.createElement("span", { className: "k-button-icon k-icon k-i-arrow-s" })),
|
|
355
368
|
React.createElement("select", { name: name, ref: selectRef, tabIndex: -1, "aria-hidden": true, title: label, style: { opacity: 0, width: 1, border: 0, zIndex: -1, position: 'absolute', left: '50%' } },
|
|
356
369
|
React.createElement("option", { value: props.valueMap ? props.valueMap.call(undefined, value) : value })),
|
|
357
|
-
React.createElement(kendo_react_popup_1.Popup, { className: kendo_react_common_1.classNames(popupSettings.className, { 'k-rtl': dir === 'rtl' }), popupClass: popupSettings.popupClass, style: popupStyles, animate: popupSettings.animate, anchor: elementRef.current, show: isOpen, onOpen: onPopupOpened, onClose: onPopupClosed, appendTo: popupSettings.appendTo },
|
|
370
|
+
React.createElement(kendo_react_popup_1.Popup, { className: (0, kendo_react_common_1.classNames)(popupSettings.className, { 'k-rtl': dir === 'rtl' }), popupClass: popupSettings.popupClass, style: popupStyles, animate: popupSettings.animate, anchor: elementRef.current, show: isOpen, onOpen: onPopupOpened, onClose: onPopupClosed, appendTo: popupSettings.appendTo },
|
|
358
371
|
props.filterable && (React.createElement(ListFilter_1.default, { value: props.filter === undefined ? filter : props.filter, inputRef: inputRef, onChange: onFilterChange, onKeyDown: onInputKeyDown, size: size, rounded: rounded, fillMode: fillMode })),
|
|
359
372
|
data.length > 0 ? (React.createElement(kendo_react_treeview_1.TreeView, { ref: treeViewRef, tabIndex: tabIndex, data: treeViewData, focusIdField: dataItemKey, textField: props.textField, selectField: selectField, expandField: props.expandField, childrenField: subItemsField, expandIcons: true, onItemClick: onChange, onExpandChange: onExpand, size: size, item: props.item })) : (React.createElement(NoData, null, localization.toLanguageString(messages_1.nodata, messages_1.messages[messages_1.nodata]))))));
|
|
360
373
|
return label ? (React.createElement(kendo_react_labels_1.FloatingLabel, { label: label, editorValue: currentValueText, editorPlaceholder: placeholder, editorValid: isValid, editorDisabled: disabled, editorId: id, style: { width: style ? style.width : undefined }, children: dropdowntree, dir: dir })) : dropdowntree;
|
|
@@ -395,7 +408,7 @@ var propTypes = {
|
|
|
395
408
|
})]),
|
|
396
409
|
popupClass: PropTypes.string,
|
|
397
410
|
className: PropTypes.string,
|
|
398
|
-
appendTo: PropTypes.
|
|
411
|
+
appendTo: PropTypes.instanceOf(Element),
|
|
399
412
|
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
400
413
|
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
401
414
|
}),
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListNoData = void 0;
|
|
3
4
|
var React = require("react");
|
|
4
5
|
/**
|
|
5
6
|
* @hidden
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
var ListNoData = function (props) {
|
|
8
9
|
return React.createElement("div", { className: "k-nodata" },
|
|
9
10
|
React.createElement("div", null, props.children));
|
|
10
11
|
};
|
|
12
|
+
exports.ListNoData = ListNoData;
|
|
@@ -143,7 +143,7 @@ export interface MultiColumnComboBoxProps extends ComboBoxProps {
|
|
|
143
143
|
* @hidden
|
|
144
144
|
*/
|
|
145
145
|
onGroupScroll?: (event: {
|
|
146
|
-
group
|
|
146
|
+
group?: string;
|
|
147
147
|
}) => void;
|
|
148
148
|
/**
|
|
149
149
|
* Fires when a MultiColumnComboBox list item is about to be rendered. Used to override the default appearance of the list items.
|
|
@@ -247,4 +247,4 @@ export declare const MultiColumnComboBoxPropsContext: React.Context<(p: MultiCol
|
|
|
247
247
|
* Obtaining the `ref` returns an object of type [MultiColumnComboBoxHandle]({% slug api_dropdowns_multicolumncomboboxhandle %}).
|
|
248
248
|
*
|
|
249
249
|
*/
|
|
250
|
-
export declare const MultiColumnComboBox: React.ForwardRefExoticComponent<MultiColumnComboBoxProps & React.RefAttributes<MultiColumnComboBoxHandle>>;
|
|
250
|
+
export declare const MultiColumnComboBox: React.ForwardRefExoticComponent<MultiColumnComboBoxProps & React.RefAttributes<MultiColumnComboBoxHandle | null>>;
|
|
@@ -15,11 +15,14 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
15
15
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
16
|
t[p] = s[p];
|
|
17
17
|
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
|
19
|
-
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
20
22
|
return t;
|
|
21
23
|
};
|
|
22
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.MultiColumnComboBox = exports.MultiColumnComboBoxPropsContext = void 0;
|
|
23
26
|
var React = require("react");
|
|
24
27
|
var PropTypes = require("prop-types");
|
|
25
28
|
var MultiColumnList_1 = require("./../common/MultiColumnList");
|
|
@@ -38,7 +41,7 @@ var columnWidth = function (width, defaultWidth) {
|
|
|
38
41
|
*
|
|
39
42
|
* For more information, refer to the [Dropdowns Props Context]({% slug props-context_dropdowns %}) article.
|
|
40
43
|
*/
|
|
41
|
-
exports.MultiColumnComboBoxPropsContext = kendo_react_common_1.createPropsContext();
|
|
44
|
+
exports.MultiColumnComboBoxPropsContext = (0, kendo_react_common_1.createPropsContext)();
|
|
42
45
|
/**
|
|
43
46
|
* Represents the MultiColumnComboBox component.
|
|
44
47
|
*
|
|
@@ -47,11 +50,11 @@ exports.MultiColumnComboBoxPropsContext = kendo_react_common_1.createPropsContex
|
|
|
47
50
|
*
|
|
48
51
|
*/
|
|
49
52
|
exports.MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
50
|
-
var props = kendo_react_common_1.usePropsContext(exports.MultiColumnComboBoxPropsContext, directProps);
|
|
53
|
+
var props = (0, kendo_react_common_1.usePropsContext)(exports.MultiColumnComboBoxPropsContext, directProps);
|
|
51
54
|
var target = React.useRef(null);
|
|
52
55
|
var comboBoxRef = React.useRef(null);
|
|
53
|
-
var scrollbarWidth = kendo_react_common_1.getScrollbarWidth();
|
|
54
|
-
var _a = props.columns, columns = _a === void 0 ? defaultProps.columns : _a, _b = props.popupSettings, popupSettings = _b === void 0 ? defaultProps.popupSettings : _b, size = props.size, onOpen = props.onOpen, onClose = props.onClose, onFocus = props.onFocus, onBlur = props.onBlur, onChange = props.onChange, onFilterChange = props.onFilterChange, onPageChange = props.onPageChange, other = __rest(props, ["columns", "popupSettings", "size", "onOpen", "onClose", "onFocus", "onBlur", "onChange", "onFilterChange", "onPageChange"]);
|
|
56
|
+
var scrollbarWidth = (0, kendo_react_common_1.getScrollbarWidth)();
|
|
57
|
+
var _a = props.columns, columns = _a === void 0 ? defaultProps.columns : _a, _b = props.popupSettings, popupSettings = _b === void 0 ? defaultProps.popupSettings : _b, className = props.className, size = props.size, onOpen = props.onOpen, onClose = props.onClose, onFocus = props.onFocus, onBlur = props.onBlur, onChange = props.onChange, onFilterChange = props.onFilterChange, onPageChange = props.onPageChange, other = __rest(props, ["columns", "popupSettings", "className", "size", "onOpen", "onClose", "onFocus", "onBlur", "onChange", "onFilterChange", "onPageChange"]);
|
|
55
58
|
React.useImperativeHandle(target, function () {
|
|
56
59
|
return ({
|
|
57
60
|
element: comboBoxRef.current && comboBoxRef.current.element,
|
|
@@ -68,7 +71,7 @@ exports.MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
68
71
|
React.useImperativeHandle(ref, function () { return target.current; });
|
|
69
72
|
var initialGroupHeader = React.useMemo(function () {
|
|
70
73
|
if (initialGroupHeader === undefined && props.groupField !== undefined && props.data) {
|
|
71
|
-
return utils_1.getItemValue(props.data[0], props.groupField);
|
|
74
|
+
return (0, utils_1.getItemValue)(props.data[0], props.groupField);
|
|
72
75
|
}
|
|
73
76
|
}, [props.data, props.groupField]);
|
|
74
77
|
var _c = React.useState(initialGroupHeader), groupHeader = _c[0], setGroupHeader = _c[1];
|
|
@@ -89,16 +92,16 @@ exports.MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
89
92
|
}, [props.header, columns, groupHeader]);
|
|
90
93
|
var popupWidth = React.useMemo(function () {
|
|
91
94
|
// These additional 4px are coming from the child elements side borders (fixes horizontal scrollbar)
|
|
92
|
-
return "calc("
|
|
95
|
+
return "calc(".concat(columns.map(function (column) { return columnWidth(column.width, defaultProps.width); }).filter(Boolean).join(' + '), " + ").concat(scrollbarWidth, "px + 4px)");
|
|
93
96
|
}, [columns, scrollbarWidth]);
|
|
94
97
|
var skip = props.virtual ? props.virtual.skip : 0;
|
|
95
98
|
var itemRender = React.useCallback(function (li, liProps) {
|
|
96
|
-
var children = columns.map(function (column, i) { return (React.createElement("span", { className: "k-table-td", style: { width: column.width ? column.width : defaultProps.width }, key: column.uniqueKey ? column.uniqueKey : i }, column.field ? kendo_react_common_1.getter(column.field)(liProps.dataItem) : '')); });
|
|
99
|
+
var children = columns.map(function (column, i) { return (React.createElement("span", { className: "k-table-td", style: { width: column.width ? column.width : defaultProps.width }, key: column.uniqueKey ? column.uniqueKey : i }, column.field ? (0, kendo_react_common_1.getter)(column.field)(liProps.dataItem) : '')); });
|
|
97
100
|
var group = undefined;
|
|
98
101
|
var curGroup, prevGroup, groupGetter, data = props.data || [];
|
|
99
102
|
var index = liProps.index - skip;
|
|
100
103
|
if (props.groupField !== undefined) {
|
|
101
|
-
groupGetter = kendo_react_common_1.getter(props.groupField);
|
|
104
|
+
groupGetter = (0, kendo_react_common_1.getter)(props.groupField);
|
|
102
105
|
curGroup = groupGetter(data[index]);
|
|
103
106
|
prevGroup = groupGetter(data[index - 1]);
|
|
104
107
|
if (curGroup && prevGroup && curGroup !== prevGroup) {
|
|
@@ -109,7 +112,7 @@ exports.MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
109
112
|
children.push(React.createElement("div", { key: "group", className: "k-table-td k-table-group-td" },
|
|
110
113
|
React.createElement("span", null, group)));
|
|
111
114
|
}
|
|
112
|
-
var rendering = React.cloneElement(li, __assign({}, li.props, { className: kendo_react_common_1.classNames('k-table-row', {
|
|
115
|
+
var rendering = React.cloneElement(li, __assign(__assign({}, li.props), { className: (0, kendo_react_common_1.classNames)('k-table-row', {
|
|
113
116
|
'k-table-alt-row': liProps.index % 2 !== 0,
|
|
114
117
|
'k-focus': liProps.focused,
|
|
115
118
|
'k-selected': liProps.selected,
|
|
@@ -119,7 +122,7 @@ exports.MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
119
122
|
}, [columns, props.groupField, props.itemRender, props.data, skip]);
|
|
120
123
|
var handleEvent = React.useCallback(function (handler, event) {
|
|
121
124
|
if (handler) {
|
|
122
|
-
handler.call(undefined, __assign({}, event, { target: target.current }));
|
|
125
|
+
handler.call(undefined, __assign(__assign({}, event), { target: target.current }));
|
|
123
126
|
}
|
|
124
127
|
}, []);
|
|
125
128
|
var onOpenHandler = React.useCallback(function (event) { return handleEvent(onOpen, event); }, [onOpen]);
|
|
@@ -132,11 +135,11 @@ exports.MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
132
135
|
var onGroupScroll = React.useCallback(function (event) {
|
|
133
136
|
setGroupHeader(event.group);
|
|
134
137
|
}, []);
|
|
135
|
-
React.useEffect(function () { kendo_react_common_1.setScrollbarWidth(); });
|
|
138
|
+
React.useEffect(function () { (0, kendo_react_common_1.setScrollbarWidth)(); });
|
|
136
139
|
var List = React.useCallback(function (listProps) { return React.createElement(MultiColumnList_1.MultiColumnList, __assign({}, listProps)); }, []);
|
|
137
|
-
return (React.createElement(ComboBox_1.ComboBox, __assign({}, other, { list: List, popupSettings: __assign({ width: popupWidth }, popupSettings, { popupClass: 'k-dropdowngrid-popup k-reset', className: popupSettings.className }), ref: comboBoxRef, header: header, itemRender: itemRender, size: props.size, rounded: props.rounded, fillMode: props.fillMode, onOpen: onOpenHandler, onClose: onCloseHandler, onFocus: onFocusHandler, onBlur: onBlurHandler, onChange: onChangeHandler, onFilterChange: onFilterChangeHandler, onPageChange: onPageChangeHandler, onGroupScroll: onGroupScroll, className: 'k-dropdowngrid' })));
|
|
140
|
+
return (React.createElement(ComboBox_1.ComboBox, __assign({}, other, { list: List, popupSettings: __assign(__assign({ width: popupWidth }, popupSettings), { popupClass: 'k-dropdowngrid-popup k-reset', className: popupSettings.className }), ref: comboBoxRef, header: header, itemRender: itemRender, size: props.size, rounded: props.rounded, fillMode: props.fillMode, onOpen: onOpenHandler, onClose: onCloseHandler, onFocus: onFocusHandler, onBlur: onBlurHandler, onChange: onChangeHandler, onFilterChange: onFilterChangeHandler, onPageChange: onPageChangeHandler, onGroupScroll: onGroupScroll, className: (0, kendo_react_common_1.classNames)('k-dropdowngrid', className) })));
|
|
138
141
|
});
|
|
139
|
-
var propTypes = __assign({}, ComboBox_1.ComboBoxWithoutContext.propTypes, { columns: PropTypes.any.isRequired });
|
|
142
|
+
var propTypes = __assign(__assign({}, ComboBox_1.ComboBoxWithoutContext.propTypes), { columns: PropTypes.any.isRequired });
|
|
140
143
|
var defaultProps = {
|
|
141
144
|
columns: [],
|
|
142
145
|
popupSettings: {},
|