@progress/kendo-react-dropdowns 5.4.0-dev.202205271059 → 5.4.0-dev.202206090823
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 +6 -6
- package/dist/es/AutoComplete/AutoComplete.js +6 -4
- package/dist/es/ComboBox/ComboBox.d.ts +6 -6
- package/dist/es/ComboBox/ComboBox.js +12 -10
- package/dist/es/DropDownList/DropDownList.d.ts +3 -6
- package/dist/es/DropDownList/DropDownList.js +10 -8
- package/dist/es/DropDownTree/DropDownTree.d.ts +1 -1
- package/dist/es/DropDownTree/DropDownTree.js +17 -13
- package/dist/es/MultiColumnComboBox/MultiColumnComboBox.d.ts +2 -2
- package/dist/es/MultiColumnComboBox/MultiColumnComboBox.js +1 -1
- package/dist/es/MultiSelect/MultiSelect.d.ts +5 -5
- package/dist/es/MultiSelect/MultiSelect.js +23 -17
- package/dist/es/MultiSelect/TagList.d.ts +1 -0
- package/dist/es/MultiSelect/TagList.js +1 -1
- package/dist/es/MultiSelectTree/MultiSelectTree.d.ts +1 -1
- package/dist/es/MultiSelectTree/MultiSelectTree.js +16 -12
- package/dist/es/MultiSelectTree/utils.d.ts +3 -3
- package/dist/es/MultiSelectTree/utils.js +11 -7
- package/dist/es/common/DropDownBase.d.ts +1 -1
- package/dist/es/common/DropDownBase.js +2 -0
- package/dist/es/common/List.d.ts +2 -2
- package/dist/es/common/List.js +1 -1
- package/dist/es/common/ListContainer.d.ts +1 -0
- package/dist/es/common/ListFilter.js +6 -4
- package/dist/es/common/ListItem.d.ts +1 -1
- package/dist/es/common/MultiColumnList.d.ts +2 -1
- package/dist/es/common/Navigation.d.ts +1 -1
- package/dist/es/common/SearchBar.d.ts +1 -1
- package/dist/es/common/SearchBar.js +3 -1
- package/dist/es/common/VirtualScroll.d.ts +1 -1
- package/dist/es/common/VirtualScroll.js +5 -1
- package/dist/es/package-metadata.js +1 -1
- package/dist/npm/AutoComplete/AutoComplete.d.ts +6 -6
- package/dist/npm/AutoComplete/AutoComplete.js +21 -19
- package/dist/npm/ComboBox/ComboBox.d.ts +6 -6
- package/dist/npm/ComboBox/ComboBox.js +46 -44
- package/dist/npm/DropDownList/DropDownList.d.ts +3 -6
- package/dist/npm/DropDownList/DropDownList.js +37 -35
- package/dist/npm/DropDownTree/DropDownTree.d.ts +1 -1
- package/dist/npm/DropDownTree/DropDownTree.js +33 -29
- package/dist/npm/MultiColumnComboBox/MultiColumnComboBox.d.ts +2 -2
- package/dist/npm/MultiColumnComboBox/MultiColumnComboBox.js +10 -10
- package/dist/npm/MultiSelect/MultiSelect.d.ts +5 -5
- package/dist/npm/MultiSelect/MultiSelect.js +43 -37
- package/dist/npm/MultiSelect/TagList.d.ts +1 -0
- package/dist/npm/MultiSelect/TagList.js +1 -1
- package/dist/npm/MultiSelectTree/MultiSelectTree.d.ts +1 -1
- package/dist/npm/MultiSelectTree/MultiSelectTree.js +30 -26
- package/dist/npm/MultiSelectTree/utils.d.ts +3 -3
- package/dist/npm/MultiSelectTree/utils.js +18 -14
- package/dist/npm/common/ClearButton.js +2 -2
- package/dist/npm/common/DropDownBase.d.ts +1 -1
- package/dist/npm/common/DropDownBase.js +7 -5
- package/dist/npm/common/List.d.ts +2 -2
- package/dist/npm/common/List.js +7 -7
- package/dist/npm/common/ListContainer.d.ts +1 -0
- package/dist/npm/common/ListDefaultItem.js +2 -2
- package/dist/npm/common/ListFilter.js +7 -5
- package/dist/npm/common/ListItem.d.ts +1 -1
- package/dist/npm/common/ListItem.js +2 -2
- package/dist/npm/common/MultiColumnList.d.ts +2 -1
- package/dist/npm/common/Navigation.d.ts +1 -1
- package/dist/npm/common/Navigation.js +1 -1
- package/dist/npm/common/SearchBar.d.ts +1 -1
- package/dist/npm/common/SearchBar.js +3 -1
- package/dist/npm/common/VirtualScroll.d.ts +1 -1
- package/dist/npm/common/VirtualScroll.js +5 -1
- package/dist/npm/main.js +5 -1
- package/dist/npm/package-metadata.js +1 -1
- package/dist/systemjs/kendo-react-dropdowns.js +1 -1
- package/package.json +13 -13
|
@@ -10,10 +10,14 @@ 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) {
|
|
14
|
-
for (var i = 0,
|
|
15
|
-
|
|
16
|
-
|
|
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));
|
|
17
21
|
};
|
|
18
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
23
|
exports.DropDownTree = exports.DropDownTreePropsContext = void 0;
|
|
@@ -39,8 +43,8 @@ var ValueHolder = function (props) {
|
|
|
39
43
|
var toLevel = function (hierarchicalIndex) {
|
|
40
44
|
return hierarchicalIndex.split('_').map(function (i) { return parseInt(i, 10); });
|
|
41
45
|
};
|
|
42
|
-
var getValidity = function (
|
|
43
|
-
var validationMessage =
|
|
46
|
+
var getValidity = function (parameters, hasValue) {
|
|
47
|
+
var validationMessage = parameters.validationMessage, valid = parameters.valid, required = parameters.required;
|
|
44
48
|
return ({
|
|
45
49
|
customError: validationMessage !== undefined,
|
|
46
50
|
valid: Boolean(valid !== undefined ? valid : (!required || hasValue)),
|
|
@@ -67,7 +71,7 @@ var defaultProps = {
|
|
|
67
71
|
*
|
|
68
72
|
* For more information, refer to the [Dropdowns Props Context]({% slug props-context_dropdowns %}) article.
|
|
69
73
|
*/
|
|
70
|
-
exports.DropDownTreePropsContext = kendo_react_common_1.createPropsContext();
|
|
74
|
+
exports.DropDownTreePropsContext = (0, kendo_react_common_1.createPropsContext)();
|
|
71
75
|
/**
|
|
72
76
|
* Represents the DropDownTree component.
|
|
73
77
|
*
|
|
@@ -76,12 +80,12 @@ exports.DropDownTreePropsContext = kendo_react_common_1.createPropsContext();
|
|
|
76
80
|
*/
|
|
77
81
|
exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
78
82
|
var _a, _b;
|
|
79
|
-
kendo_react_common_2.validatePackage(package_metadata_1.packageMetadata);
|
|
80
|
-
var props = kendo_react_common_1.usePropsContext(exports.DropDownTreePropsContext, directProps);
|
|
81
|
-
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)(); }, []);
|
|
82
86
|
var id = props.id || calculatedId;
|
|
83
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;
|
|
84
|
-
var tabIndex = kendo_react_common_1.getTabIndex(props.tabIndex, disabled);
|
|
88
|
+
var tabIndex = (0, kendo_react_common_1.getTabIndex)(props.tabIndex, disabled);
|
|
85
89
|
var target = React.useRef(null);
|
|
86
90
|
var elementRef = React.useRef(null);
|
|
87
91
|
var inputRef = React.useRef(null);
|
|
@@ -91,8 +95,8 @@ exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
|
91
95
|
var _k = React.useState(undefined), stateValue = _k[0], setStateValue = _k[1];
|
|
92
96
|
var controlled = props.value !== undefined;
|
|
93
97
|
var value = controlled ? props.value : (stateValue !== undefined ? stateValue : props.defaultValue);
|
|
94
|
-
var hasValue = utils_1.isPresent(value);
|
|
95
|
-
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) : '';
|
|
96
100
|
var validity = getValidity({ validationMessage: validationMessage, valid: valid, required: required }, hasValue);
|
|
97
101
|
var focus = React.useCallback(function () { return elementRef.current && elementRef.current.focus(); }, []);
|
|
98
102
|
React.useImperativeHandle(target, function () { return ({
|
|
@@ -101,10 +105,10 @@ exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
|
101
105
|
focus: focus
|
|
102
106
|
}); });
|
|
103
107
|
React.useImperativeHandle(ref, function () { return target.current; });
|
|
104
|
-
var dir = kendo_react_common_1.useRtl(elementRef, props.dir);
|
|
108
|
+
var dir = (0, kendo_react_common_1.useRtl)(elementRef, props.dir);
|
|
105
109
|
var initialStyleWidth = popupSettings.width !== undefined ?
|
|
106
110
|
popupSettings.width : (style.width !== undefined ? style.width : defaultProps.popupSettings.width);
|
|
107
|
-
var popupWidth = useDropdownWidth_1.useDropdownWidth(elementRef, initialStyleWidth);
|
|
111
|
+
var popupWidth = (0, useDropdownWidth_1.useDropdownWidth)(elementRef, initialStyleWidth);
|
|
108
112
|
var popupStyles = __assign({ width: popupWidth }, (dir !== undefined ? { direction: dir } : {}));
|
|
109
113
|
var _l = React.useState(false), open = _l[0], setOpen = _l[1];
|
|
110
114
|
var isOpen = opened !== undefined ? opened : open;
|
|
@@ -178,7 +182,7 @@ exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
|
178
182
|
keyCode === kendo_react_common_1.Keys.home || keyCode === kendo_react_common_1.Keys.end)) {
|
|
179
183
|
if (keyCode === kendo_react_common_1.Keys.up && inputRef.current) {
|
|
180
184
|
var items = Array.from(treeview.querySelectorAll('.k-treeview-item'));
|
|
181
|
-
var focusedItem = __spreadArray([], items).reverse().find(function (i) { return Boolean(i && i.querySelector('.k-focus')); });
|
|
185
|
+
var focusedItem = __spreadArray([], items, true).reverse().find(function (i) { return Boolean(i && i.querySelector('.k-focus')); });
|
|
182
186
|
if (focusedItem && items.indexOf(focusedItem) === 0) {
|
|
183
187
|
return switchFocus(function () { focusElement(inputRef.current); });
|
|
184
188
|
}
|
|
@@ -274,7 +278,7 @@ exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
|
274
278
|
}
|
|
275
279
|
}, [props.onChange, controlled]);
|
|
276
280
|
var onChange = React.useCallback(function (event) {
|
|
277
|
-
if (utils_1.areSame(event.item, value, dataItemKey) || !target.current) {
|
|
281
|
+
if ((0, utils_1.areSame)(event.item, value, dataItemKey) || !target.current) {
|
|
278
282
|
return;
|
|
279
283
|
}
|
|
280
284
|
var item = event.item, itemHierarchicalIndex = event.itemHierarchicalIndex, nativeEvent = event.nativeEvent, syntheticEvent = event.syntheticEvent;
|
|
@@ -330,20 +334,20 @@ exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
|
330
334
|
}, [props.onFilterChange, props.filter, props.textField]);
|
|
331
335
|
var treeViewData = React.useMemo(function () {
|
|
332
336
|
return (controlled || !hasValue) ? data :
|
|
333
|
-
kendo_react_common_1.mapTree(data, subItemsField, function (item) {
|
|
337
|
+
(0, kendo_react_common_1.mapTree)(data, subItemsField, function (item) {
|
|
334
338
|
var _a;
|
|
335
|
-
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));
|
|
336
340
|
});
|
|
337
341
|
}, [data, value, controlled, hasValue, selectField, subItemsField]);
|
|
338
342
|
var NoData = props.listNoData || ListNoData_1.ListNoData;
|
|
339
343
|
var ValueComponent = props.valueHolder || ValueHolder;
|
|
340
|
-
var localization = kendo_react_intl_1.useLocalization();
|
|
344
|
+
var localization = (0, kendo_react_intl_1.useLocalization)();
|
|
341
345
|
var isValid = !validityStyles || validity.valid;
|
|
342
346
|
var size = props.size, rounded = props.rounded, fillMode = props.fillMode;
|
|
343
|
-
var dropdowntree = (React.createElement("span", { className: kendo_react_common_1.classNames('k-dropdowntree k-picker', props.className, (_a = {},
|
|
344
|
-
_a["k-picker-"
|
|
345
|
-
_a["k-rounded-"
|
|
346
|
-
_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,
|
|
347
351
|
_a['k-focus'] = focused,
|
|
348
352
|
_a['k-invalid'] = !isValid,
|
|
349
353
|
_a['k-loading'] = props.loading,
|
|
@@ -355,15 +359,15 @@ exports.DropDownTree = React.forwardRef(function (directProps, ref) {
|
|
|
355
359
|
props.loading && React.createElement("span", { className: "k-icon k-i-loading k-input-loading-icon" }),
|
|
356
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(); } },
|
|
357
361
|
React.createElement("span", { className: "k-icon k-i-x" }))),
|
|
358
|
-
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 = {},
|
|
359
|
-
_b["k-button-"
|
|
360
|
-
_b["k-button-"
|
|
361
|
-
_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,
|
|
362
366
|
_b)) },
|
|
363
367
|
React.createElement("span", { className: "k-button-icon k-icon k-i-arrow-s" })),
|
|
364
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%' } },
|
|
365
369
|
React.createElement("option", { value: props.valueMap ? props.valueMap.call(undefined, value) : value })),
|
|
366
|
-
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 },
|
|
367
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 })),
|
|
368
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]))))));
|
|
369
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;
|
|
@@ -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>>;
|
|
@@ -41,7 +41,7 @@ var columnWidth = function (width, defaultWidth) {
|
|
|
41
41
|
*
|
|
42
42
|
* For more information, refer to the [Dropdowns Props Context]({% slug props-context_dropdowns %}) article.
|
|
43
43
|
*/
|
|
44
|
-
exports.MultiColumnComboBoxPropsContext = kendo_react_common_1.createPropsContext();
|
|
44
|
+
exports.MultiColumnComboBoxPropsContext = (0, kendo_react_common_1.createPropsContext)();
|
|
45
45
|
/**
|
|
46
46
|
* Represents the MultiColumnComboBox component.
|
|
47
47
|
*
|
|
@@ -50,10 +50,10 @@ exports.MultiColumnComboBoxPropsContext = kendo_react_common_1.createPropsContex
|
|
|
50
50
|
*
|
|
51
51
|
*/
|
|
52
52
|
exports.MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
53
|
-
var props = kendo_react_common_1.usePropsContext(exports.MultiColumnComboBoxPropsContext, directProps);
|
|
53
|
+
var props = (0, kendo_react_common_1.usePropsContext)(exports.MultiColumnComboBoxPropsContext, directProps);
|
|
54
54
|
var target = React.useRef(null);
|
|
55
55
|
var comboBoxRef = React.useRef(null);
|
|
56
|
-
var scrollbarWidth = kendo_react_common_1.getScrollbarWidth();
|
|
56
|
+
var scrollbarWidth = (0, kendo_react_common_1.getScrollbarWidth)();
|
|
57
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"]);
|
|
58
58
|
React.useImperativeHandle(target, function () {
|
|
59
59
|
return ({
|
|
@@ -71,7 +71,7 @@ exports.MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
71
71
|
React.useImperativeHandle(ref, function () { return target.current; });
|
|
72
72
|
var initialGroupHeader = React.useMemo(function () {
|
|
73
73
|
if (initialGroupHeader === undefined && props.groupField !== undefined && props.data) {
|
|
74
|
-
return utils_1.getItemValue(props.data[0], props.groupField);
|
|
74
|
+
return (0, utils_1.getItemValue)(props.data[0], props.groupField);
|
|
75
75
|
}
|
|
76
76
|
}, [props.data, props.groupField]);
|
|
77
77
|
var _c = React.useState(initialGroupHeader), groupHeader = _c[0], setGroupHeader = _c[1];
|
|
@@ -92,16 +92,16 @@ exports.MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
92
92
|
}, [props.header, columns, groupHeader]);
|
|
93
93
|
var popupWidth = React.useMemo(function () {
|
|
94
94
|
// These additional 4px are coming from the child elements side borders (fixes horizontal scrollbar)
|
|
95
|
-
return "calc("
|
|
95
|
+
return "calc(".concat(columns.map(function (column) { return columnWidth(column.width, defaultProps.width); }).filter(Boolean).join(' + '), " + ").concat(scrollbarWidth, "px + 4px)");
|
|
96
96
|
}, [columns, scrollbarWidth]);
|
|
97
97
|
var skip = props.virtual ? props.virtual.skip : 0;
|
|
98
98
|
var itemRender = React.useCallback(function (li, liProps) {
|
|
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 ? 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) : '')); });
|
|
100
100
|
var group = undefined;
|
|
101
101
|
var curGroup, prevGroup, groupGetter, data = props.data || [];
|
|
102
102
|
var index = liProps.index - skip;
|
|
103
103
|
if (props.groupField !== undefined) {
|
|
104
|
-
groupGetter = kendo_react_common_1.getter(props.groupField);
|
|
104
|
+
groupGetter = (0, kendo_react_common_1.getter)(props.groupField);
|
|
105
105
|
curGroup = groupGetter(data[index]);
|
|
106
106
|
prevGroup = groupGetter(data[index - 1]);
|
|
107
107
|
if (curGroup && prevGroup && curGroup !== prevGroup) {
|
|
@@ -112,7 +112,7 @@ exports.MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
112
112
|
children.push(React.createElement("div", { key: "group", className: "k-table-td k-table-group-td" },
|
|
113
113
|
React.createElement("span", null, group)));
|
|
114
114
|
}
|
|
115
|
-
var rendering = React.cloneElement(li, __assign(__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', {
|
|
116
116
|
'k-table-alt-row': liProps.index % 2 !== 0,
|
|
117
117
|
'k-focus': liProps.focused,
|
|
118
118
|
'k-selected': liProps.selected,
|
|
@@ -135,9 +135,9 @@ exports.MultiColumnComboBox = React.forwardRef(function (directProps, ref) {
|
|
|
135
135
|
var onGroupScroll = React.useCallback(function (event) {
|
|
136
136
|
setGroupHeader(event.group);
|
|
137
137
|
}, []);
|
|
138
|
-
React.useEffect(function () { kendo_react_common_1.setScrollbarWidth(); });
|
|
138
|
+
React.useEffect(function () { (0, kendo_react_common_1.setScrollbarWidth)(); });
|
|
139
139
|
var List = React.useCallback(function (listProps) { return React.createElement(MultiColumnList_1.MultiColumnList, __assign({}, listProps)); }, []);
|
|
140
|
-
return (React.createElement(ComboBox_1.ComboBox, __assign({}, other, { list: List, popupSettings: __assign(__assign({ width: popupWidth }, popupSettings), { popupClass: 'k-dropdowngrid-popup k-reset', className: popupSettings.className }), ref: comboBoxRef, header: header, itemRender: itemRender, size: props.size, rounded: props.rounded, fillMode: props.fillMode, onOpen: onOpenHandler, onClose: onCloseHandler, onFocus: onFocusHandler, onBlur: onBlurHandler, onChange: onChangeHandler, onFilterChange: onFilterChangeHandler, onPageChange: onPageChangeHandler, onGroupScroll: onGroupScroll, className: kendo_react_common_1.classNames('k-dropdowngrid', className) })));
|
|
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) })));
|
|
141
141
|
});
|
|
142
142
|
var propTypes = __assign(__assign({}, ComboBox_1.ComboBoxWithoutContext.propTypes), { columns: PropTypes.any.isRequired });
|
|
143
143
|
var defaultProps = {
|
|
@@ -33,10 +33,10 @@ export declare class MultiSelectWithoutContext extends React.Component<MultiSele
|
|
|
33
33
|
defaultValue: PropTypes.Requireable<any[]>;
|
|
34
34
|
dataItemKey: PropTypes.Requireable<string>;
|
|
35
35
|
placeholder: PropTypes.Requireable<string>;
|
|
36
|
-
tags: PropTypes.Requireable<PropTypes.InferProps<{
|
|
36
|
+
tags: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
37
37
|
text: PropTypes.Requireable<string>;
|
|
38
38
|
data: PropTypes.Requireable<any[]>;
|
|
39
|
-
}>[]>;
|
|
39
|
+
}> | null | undefined)[]>;
|
|
40
40
|
tagRender: PropTypes.Requireable<(...args: any[]) => any>;
|
|
41
41
|
id: PropTypes.Requireable<string>;
|
|
42
42
|
ariaLabelledBy: PropTypes.Requireable<string>;
|
|
@@ -88,9 +88,9 @@ export declare class MultiSelectWithoutContext extends React.Component<MultiSele
|
|
|
88
88
|
static defaultProps: {
|
|
89
89
|
autoClose: boolean;
|
|
90
90
|
required: boolean;
|
|
91
|
-
size: "small" | "medium" | "large";
|
|
92
|
-
rounded: "small" | "medium" | "full" | "large";
|
|
93
|
-
fillMode: "flat" | "
|
|
91
|
+
size: "small" | "medium" | "large" | null | undefined;
|
|
92
|
+
rounded: "small" | "medium" | "full" | "large" | null | undefined;
|
|
93
|
+
fillMode: "flat" | "outline" | "solid" | null | undefined;
|
|
94
94
|
popupSettings: {
|
|
95
95
|
height: string;
|
|
96
96
|
};
|
|
@@ -25,10 +25,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
25
25
|
};
|
|
26
26
|
return __assign.apply(this, arguments);
|
|
27
27
|
};
|
|
28
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
29
|
-
for (var i = 0,
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
29
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
30
|
+
if (ar || !(i in from)) {
|
|
31
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
32
|
+
ar[i] = from[i];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
32
36
|
};
|
|
33
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
38
|
exports.MultiSelect = exports.MultiSelectPropsContext = exports.MultiSelectWithoutContext = void 0;
|
|
@@ -67,10 +71,12 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
67
71
|
_this.state = {
|
|
68
72
|
activedescendant: settings_1.ActiveDescendant.PopupList
|
|
69
73
|
};
|
|
74
|
+
_this._element = null;
|
|
70
75
|
_this._valueItemsDuringOnChange = null;
|
|
71
|
-
_this._inputId = kendo_react_common_1.guid();
|
|
76
|
+
_this._inputId = (0, kendo_react_common_1.guid)();
|
|
72
77
|
_this.base = new DropDownBase_1.default(_this);
|
|
73
78
|
_this._tags = [];
|
|
79
|
+
_this._input = null;
|
|
74
80
|
_this._skipFocusEvent = false;
|
|
75
81
|
_this.scrollToFocused = false;
|
|
76
82
|
/**
|
|
@@ -88,14 +94,14 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
88
94
|
var _a = _this.props, _b = _a.data, data = _b === void 0 ? [] : _b, dataItemKey = _a.dataItemKey, virtual = _a.virtual;
|
|
89
95
|
var skip = virtual ? virtual.skip : 0;
|
|
90
96
|
var dataItem = data[index - skip];
|
|
91
|
-
var indexInValue = _this.value.findIndex(function (i) { return utils_1.areSame(i, dataItem, dataItemKey); });
|
|
97
|
+
var indexInValue = _this.value.findIndex(function (i) { return (0, utils_1.areSame)(i, dataItem, dataItemKey); });
|
|
92
98
|
var newItems = [];
|
|
93
99
|
if (indexInValue !== -1) { // item is already selected
|
|
94
100
|
newItems = _this.value;
|
|
95
101
|
newItems.splice(indexInValue, 1);
|
|
96
102
|
}
|
|
97
103
|
else {
|
|
98
|
-
newItems = __spreadArray(__spreadArray([], _this.value), [dataItem]);
|
|
104
|
+
newItems = __spreadArray(__spreadArray([], _this.value, true), [dataItem], false);
|
|
99
105
|
}
|
|
100
106
|
var text = _this.props.filter !== undefined ? _this.props.filter : _this.state.text;
|
|
101
107
|
if (text) {
|
|
@@ -125,7 +131,7 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
125
131
|
_this.focus();
|
|
126
132
|
}
|
|
127
133
|
var selected = _this.value;
|
|
128
|
-
utils_1.removeDataItems(selected, itemsToRemove, _this.props.dataItemKey);
|
|
134
|
+
(0, utils_1.removeDataItems)(selected, itemsToRemove, _this.props.dataItemKey);
|
|
129
135
|
_this.triggerOnChange(selected, state);
|
|
130
136
|
_this.applyState(state);
|
|
131
137
|
};
|
|
@@ -192,7 +198,7 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
192
198
|
_this.base.togglePopup(state);
|
|
193
199
|
}
|
|
194
200
|
var text = _this.props.filter !== undefined ? _this.props.filter : _this.state.text;
|
|
195
|
-
if (utils_1.isPresent(text) && text !== '') {
|
|
201
|
+
if ((0, utils_1.isPresent)(text) && text !== '') {
|
|
196
202
|
_this.base.filterChanged('', state);
|
|
197
203
|
}
|
|
198
204
|
if (_this.state.text) {
|
|
@@ -255,8 +261,8 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
255
261
|
dir: dir !== undefined ? dir : base.dirCalculated,
|
|
256
262
|
width: popupWidth,
|
|
257
263
|
popupSettings: {
|
|
258
|
-
popupClass: kendo_react_common_1.classNames(popupSettings.popupClass, 'k-list', (_a = {},
|
|
259
|
-
_a["k-list-"
|
|
264
|
+
popupClass: (0, kendo_react_common_1.classNames)(popupSettings.popupClass, 'k-list', (_a = {},
|
|
265
|
+
_a["k-list-".concat(sizeMap[size] || size)] = size,
|
|
260
266
|
_a['k-virtual-list'] = _this.base.vs.enabled,
|
|
261
267
|
_a)),
|
|
262
268
|
className: popupSettings.className,
|
|
@@ -270,10 +276,10 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
270
276
|
itemsCount: [data.length, _this.value.length]
|
|
271
277
|
};
|
|
272
278
|
var focusedType = _this.getFocusedState().focusedType;
|
|
273
|
-
var customItem = allowCustom && text && (React.createElement("div", { className: kendo_react_common_1.classNames('k-list', (_b = {},
|
|
274
|
-
_b["k-list-"
|
|
279
|
+
var customItem = allowCustom && text && (React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-list', (_b = {},
|
|
280
|
+
_b["k-list-".concat(sizeMap[size] || size)] = size,
|
|
275
281
|
_b)), key: "customitem", onClick: _this.customItemSelect, onMouseDown: preventDefault },
|
|
276
|
-
React.createElement("div", { className: kendo_react_common_1.classNames('k-list-item k-custom-item', { 'k-focus': isCustom(focusedType) }), style: { fontStyle: 'italic' } },
|
|
282
|
+
React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-list-item k-custom-item', { 'k-focus': isCustom(focusedType) }), style: { fontStyle: 'italic' } },
|
|
277
283
|
text,
|
|
278
284
|
React.createElement("span", { className: "k-icon k-i-plus", style: { position: 'absolute', right: '0.5em' } }))));
|
|
279
285
|
return (React.createElement(ListContainer_1.default, __assign({}, listContainerProps),
|
|
@@ -289,7 +295,7 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
289
295
|
var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
|
|
290
296
|
var focusedIndex = _this.getFocusedState().focusedIndex;
|
|
291
297
|
var popupSettings = _this.base.getPopupSettings();
|
|
292
|
-
var translate = "translateY("
|
|
298
|
+
var translate = "translateY(".concat(vs.translate, "px)");
|
|
293
299
|
return (React.createElement(List_1.default, { id: _this.base.listBoxId, show: opened, data: data.slice(), focusedIndex: focusedIndex - skip, value: _this.value, textField: textField, valueField: dataItemKey, optionsGuid: _this.base.guid, listRef: function (list) { vs.list = _this.base.list = list; }, wrapperStyle: { maxHeight: popupSettings.height }, wrapperCssClass: "k-list-content", listStyle: vs.enabled ? { transform: translate } : undefined, key: "listKey", skip: skip, onClick: _this.handleItemClick, itemRender: itemRender, noDataRender: listNoDataRender, onMouseDown: preventDefault, onBlur: _this.handleBlur, onScroll: function (e) {
|
|
294
300
|
vs.scrollHandler(e);
|
|
295
301
|
}, wrapperRef: vs.scrollerRef, scroller: _this.base.renderScrollElement() }));
|
|
@@ -309,7 +315,7 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
309
315
|
}
|
|
310
316
|
state.data.focusedIndex = undefined;
|
|
311
317
|
_this.base.filterChanged('', state);
|
|
312
|
-
var newItems = __spreadArray(__spreadArray([], _this.value), [item]);
|
|
318
|
+
var newItems = __spreadArray(__spreadArray([], _this.value, true), [item], false);
|
|
313
319
|
_this.triggerOnChange(newItems, state);
|
|
314
320
|
_this.base.togglePopup(state);
|
|
315
321
|
_this.applyState(state);
|
|
@@ -385,7 +391,7 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
385
391
|
: _this.props.validationMessage || VALIDATION_MESSAGE);
|
|
386
392
|
}
|
|
387
393
|
};
|
|
388
|
-
kendo_react_common_2.validatePackage(package_metadata_1.packageMetadata);
|
|
394
|
+
(0, kendo_react_common_2.validatePackage)(package_metadata_1.packageMetadata);
|
|
389
395
|
return _this;
|
|
390
396
|
}
|
|
391
397
|
Object.defineProperty(MultiSelectWithoutContext.prototype, "element", {
|
|
@@ -560,7 +566,7 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
560
566
|
var tagsToRender = [];
|
|
561
567
|
if (tags === undefined) {
|
|
562
568
|
this.value.forEach(function (item) {
|
|
563
|
-
tagsToRender.push({ text: utils_1.getItemValue(item, textField), data: [item] });
|
|
569
|
+
tagsToRender.push({ text: (0, utils_1.getItemValue)(item, textField), data: [item] });
|
|
564
570
|
});
|
|
565
571
|
}
|
|
566
572
|
else {
|
|
@@ -569,10 +575,10 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
569
575
|
this.setItems(tagsToRender, this._tags);
|
|
570
576
|
var isValid = !this.validityStyles || this.validity.valid;
|
|
571
577
|
var clearButton = Boolean(filter !== undefined ? filter : text) || this.value.length > 0;
|
|
572
|
-
var component = (React.createElement("div", { ref: this.componentRef, className: kendo_react_common_1.classNames('k-multiselect k-input', className, (_a = {},
|
|
573
|
-
_a["k-input-"
|
|
574
|
-
_a["k-rounded-"
|
|
575
|
-
_a["k-input-"
|
|
578
|
+
var component = (React.createElement("div", { ref: this.componentRef, className: (0, kendo_react_common_1.classNames)('k-multiselect k-input', className, (_a = {},
|
|
579
|
+
_a["k-input-".concat(sizeMap[size] || size)] = size,
|
|
580
|
+
_a["k-rounded-".concat(roundedMap[rounded] || rounded)] = rounded,
|
|
581
|
+
_a["k-input-".concat(fillMode)] = fillMode,
|
|
576
582
|
_a['k-focus'] = focused && !disabled,
|
|
577
583
|
_a['k-invalid'] = !isValid,
|
|
578
584
|
_a['k-disabled'] = disabled,
|
|
@@ -581,15 +587,15 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
581
587
|
_a)), style: !label
|
|
582
588
|
? style
|
|
583
589
|
: __assign(__assign({}, style), { width: undefined }), dir: dir, onFocus: this.handleFocus, onBlur: this.handleBlur, onClick: this.handleWrapperClick, onMouseDown: utils_1.preventDefaultNonInputs },
|
|
584
|
-
React.createElement("div", { className: kendo_react_common_1.classNames('k-input-values k-chip-list k-selection-multiple', (_b = {},
|
|
585
|
-
_b["k-chip-list-"
|
|
590
|
+
React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-input-values k-chip-list k-selection-multiple', (_b = {},
|
|
591
|
+
_b["k-chip-list-".concat(sizeMap[size] || size)] = size,
|
|
586
592
|
_b)), role: "listbox", id: 'tagslist-' + this.base.guid },
|
|
587
|
-
tagsToRender.length > 0 && React.createElement(TagList_1.default, { tagRender: this.props.tagRender, onTagDelete: this.onTagDelete, data: tagsToRender, guid: this.base.guid, focused: focusedTag ? tagsToRender.find(function (t) { return utils_1.matchTags(t, focusedTag, dataItemKey); }) : undefined, size: size }),
|
|
593
|
+
tagsToRender.length > 0 && React.createElement(TagList_1.default, { tagRender: this.props.tagRender, onTagDelete: this.onTagDelete, data: tagsToRender, guid: this.base.guid, focused: focusedTag ? tagsToRender.find(function (t) { return (0, utils_1.matchTags)(t, focusedTag, dataItemKey); }) : undefined, size: size }),
|
|
588
594
|
this.renderSearchbar(id)),
|
|
589
595
|
loading && React.createElement("span", { className: "k-icon k-i-loading k-input-loading-icon" }),
|
|
590
596
|
clearButton && React.createElement(ClearButton_1.default, { onClick: this.clearButtonClick }),
|
|
591
597
|
this.renderListContainer()));
|
|
592
|
-
return label ? (React.createElement(kendo_react_labels_1.FloatingLabel, { label: label, editorId: id, editorValue: text || utils_1.getItemValue(this.value[0], textField), editorValid: isValid, editorDisabled: disabled, style: { width: style ? style.width : undefined }, children: component })) : component;
|
|
598
|
+
return label ? (React.createElement(kendo_react_labels_1.FloatingLabel, { label: label, editorId: id, editorValue: text || (0, utils_1.getItemValue)(this.value[0], textField), editorValid: isValid, editorDisabled: disabled, style: { width: style ? style.width : undefined }, children: component })) : component;
|
|
593
599
|
};
|
|
594
600
|
MultiSelectWithoutContext.prototype.renderSearchbar = function (id) {
|
|
595
601
|
var _a = this.state, activedescendant = _a.activedescendant, focusedTag = _a.focusedTag;
|
|
@@ -599,9 +605,9 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
599
605
|
var focusedIndex = this.getFocusedState().focusedIndex;
|
|
600
606
|
var placeholderToShow = this.value.length === 0 && !text ? placeholder : undefined;
|
|
601
607
|
var ariaActivedescendant = activedescendant === settings_1.ActiveDescendant.TagsList && focusedTag !== undefined ?
|
|
602
|
-
"tag-"
|
|
603
|
-
"option-"
|
|
604
|
-
return (React.createElement(SearchBar_1.default, { id: id, size: Math.max((placeholderToShow || '').length, text.length, 1), tabIndex: this.props.tabIndex, accessKey: this.props.accessKey, placeholder: placeholderToShow, value: text, onChange: this.onChangeHandler, onKeyDown: this.onInputKeyDown, ref: this.searchbarRef, disabled: disabled, expanded: opened, owns: this.base.listBoxId, activedescendant: ariaActivedescendant, ariaDescribedBy: "tagslist-"
|
|
608
|
+
"tag-".concat(this.base.guid, "-").concat(focusedTag.text.replace(/\s+/g, '-')) :
|
|
609
|
+
"option-".concat(this.base.guid, "-").concat(focusedIndex);
|
|
610
|
+
return (React.createElement(SearchBar_1.default, { id: id, size: Math.max((placeholderToShow || '').length, text.length, 1), tabIndex: this.props.tabIndex, accessKey: this.props.accessKey, placeholder: placeholderToShow, value: text, onChange: this.onChangeHandler, onKeyDown: this.onInputKeyDown, ref: this.searchbarRef, disabled: disabled, expanded: opened, owns: this.base.listBoxId, activedescendant: ariaActivedescendant, ariaDescribedBy: "tagslist-".concat(this.base.guid).concat(ariaDescribedBy ? (' ' + ariaDescribedBy) : ''), ariaLabelledBy: this.props.ariaLabelledBy }));
|
|
605
611
|
};
|
|
606
612
|
MultiSelectWithoutContext.prototype.onTagsNavigate = function (event, state) {
|
|
607
613
|
var keyCode = event.keyCode;
|
|
@@ -609,7 +615,7 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
609
615
|
var tags = this._tags;
|
|
610
616
|
var itemsKey = this.props.dataItemKey;
|
|
611
617
|
var focusedIndex = focusedTag ?
|
|
612
|
-
tags.findIndex(function (t) { return utils_1.matchTags(t, focusedTag, itemsKey); }) : -1;
|
|
618
|
+
tags.findIndex(function (t) { return (0, utils_1.matchTags)(t, focusedTag, itemsKey); }) : -1;
|
|
613
619
|
var newFocusedTag = undefined;
|
|
614
620
|
var hasFocused = focusedIndex !== -1;
|
|
615
621
|
if (keyCode === kendo_react_common_1.Keys.left) {
|
|
@@ -639,19 +645,19 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
639
645
|
else if (keyCode === kendo_react_common_1.Keys.delete) {
|
|
640
646
|
if (hasFocused) {
|
|
641
647
|
var items = this.value;
|
|
642
|
-
utils_1.removeDataItems(items, tags[focusedIndex].data, itemsKey);
|
|
648
|
+
(0, utils_1.removeDataItems)(items, tags[focusedIndex].data, itemsKey);
|
|
643
649
|
this.triggerOnChange(items, state);
|
|
644
650
|
}
|
|
645
651
|
}
|
|
646
652
|
else if (keyCode === kendo_react_common_1.Keys.backspace) {
|
|
647
653
|
var items = this.value;
|
|
648
654
|
if (hasFocused) {
|
|
649
|
-
utils_1.removeDataItems(items, tags[focusedIndex].data, itemsKey);
|
|
655
|
+
(0, utils_1.removeDataItems)(items, tags[focusedIndex].data, itemsKey);
|
|
650
656
|
this.triggerOnChange(items, state);
|
|
651
657
|
}
|
|
652
658
|
else if (!hasFocused && tags.length) {
|
|
653
659
|
var removed = tags.pop();
|
|
654
|
-
utils_1.removeDataItems(items, removed.data, itemsKey);
|
|
660
|
+
(0, utils_1.removeDataItems)(items, removed.data, itemsKey);
|
|
655
661
|
this.triggerOnChange(items, state);
|
|
656
662
|
}
|
|
657
663
|
}
|
|
@@ -663,7 +669,7 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
663
669
|
};
|
|
664
670
|
MultiSelectWithoutContext.prototype.triggerOnChange = function (items, state) {
|
|
665
671
|
if (this.props.value === undefined) {
|
|
666
|
-
state.data.value = __spreadArray([], items);
|
|
672
|
+
state.data.value = __spreadArray([], items, true);
|
|
667
673
|
}
|
|
668
674
|
this._valueItemsDuringOnChange = [];
|
|
669
675
|
this.setItems(items, this._valueItemsDuringOnChange);
|
|
@@ -708,7 +714,7 @@ var MultiSelectWithoutContext = /** @class */ (function (_super) {
|
|
|
708
714
|
}
|
|
709
715
|
else if (selected.length) {
|
|
710
716
|
var last_1 = selected[selected.length - 1];
|
|
711
|
-
focusedInd = data.findIndex(function (i) { return utils_1.areSame(i, last_1, dataItemKey); });
|
|
717
|
+
focusedInd = data.findIndex(function (i) { return (0, utils_1.areSame)(i, last_1, dataItemKey); });
|
|
712
718
|
if (data[focusedInd] !== undefined) {
|
|
713
719
|
return {
|
|
714
720
|
focusedIndex: focusedInd + skip,
|
|
@@ -753,7 +759,7 @@ exports.MultiSelectWithoutContext = MultiSelectWithoutContext;
|
|
|
753
759
|
*
|
|
754
760
|
* For more information, refer to the [Dropdowns Props Context]({% slug props-context_dropdowns %}) article.
|
|
755
761
|
*/
|
|
756
|
-
exports.MultiSelectPropsContext = kendo_react_common_1.createPropsContext();
|
|
762
|
+
exports.MultiSelectPropsContext = (0, kendo_react_common_1.createPropsContext)();
|
|
757
763
|
/* eslint-disable @typescript-eslint/no-redeclare -- intentionally naming the component the same as the type */
|
|
758
764
|
/**
|
|
759
765
|
* Represents the [KendoReact MultiSelect component]({% slug overview_multiselect %}).
|
|
@@ -780,5 +786,5 @@ exports.MultiSelectPropsContext = kendo_react_common_1.createPropsContext();
|
|
|
780
786
|
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
781
787
|
* ```
|
|
782
788
|
*/
|
|
783
|
-
exports.MultiSelect = kendo_react_common_1.withPropsContext(exports.MultiSelectPropsContext, MultiSelectWithoutContext);
|
|
789
|
+
exports.MultiSelect = (0, kendo_react_common_1.withPropsContext)(exports.MultiSelectPropsContext, MultiSelectWithoutContext);
|
|
784
790
|
exports.MultiSelect.displayName = 'KendoReactMultiSelect';
|
|
@@ -31,7 +31,7 @@ var TagList = /** @class */ (function (_super) {
|
|
|
31
31
|
var _a = this.props, data = _a.data, guid = _a.guid, focused = _a.focused, tagRender = _a.tagRender, TagComponent = _a.tag, onTagDelete = _a.onTagDelete, size = _a.size;
|
|
32
32
|
return (React.createElement(React.Fragment, null,
|
|
33
33
|
data.map(function (tagData, index) {
|
|
34
|
-
var tag = TagComponent ? (React.createElement(TagComponent, { key: tagData.text + index, tagData: tagData, guid: guid, focusedTag: focused, onTagDelete: onTagDelete })) : (React.createElement(kendo_react_buttons_1.Chip, { id: "tag-"
|
|
34
|
+
var tag = TagComponent ? (React.createElement(TagComponent, { key: tagData.text + index, tagData: tagData, guid: guid, focusedTag: focused, onTagDelete: onTagDelete })) : (React.createElement(kendo_react_buttons_1.Chip, { id: "tag-".concat(guid, "-").concat(tagData.text.replace(/\s+/g, '-')), "aria-selected": true, role: "option", "aria-setsize": data.length, key: tagData.text + index, text: tagData.text, removable: true, removeIcon: 'k-i-close', onRemove: function (e) { return onTagDelete.call(undefined, tagData.data, e.syntheticEvent); }, onMouseDown: preventDefault, onClick: stopPropagation, className: tagData === focused ? 'k-focus' : undefined, size: size }));
|
|
35
35
|
return tagRender ? tagRender(tagData, tag) : tag;
|
|
36
36
|
}),
|
|
37
37
|
this.props.children));
|
|
@@ -13,4 +13,4 @@ export declare const MultiSelectTreePropsContext: React.Context<(p: MultiSelectT
|
|
|
13
13
|
* Accepts properties of type [MultiSelectTreeProps]({% slug api_dropdowns_multiselecttreeprops %}).
|
|
14
14
|
* Obtaining the `ref` returns an object of type [MultiSelectTreeHandle]({% slug api_dropdowns_multiselecttreehandle %}).
|
|
15
15
|
*/
|
|
16
|
-
export declare const MultiSelectTree: React.ForwardRefExoticComponent<MultiSelectTreeProps & React.RefAttributes<MultiSelectTreeHandle>>;
|
|
16
|
+
export declare const MultiSelectTree: React.ForwardRefExoticComponent<MultiSelectTreeProps & React.RefAttributes<MultiSelectTreeHandle | null>>;
|