@progress/kendo-react-dropdowns 13.3.0-develop.4 → 13.3.0-develop.6
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/MultiSelect/MultiSelect.js +1 -1
- package/MultiSelect/MultiSelect.mjs +284 -271
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import
|
|
10
|
-
import { Keys as u, classNames as
|
|
8
|
+
import * as g from "react";
|
|
9
|
+
import v from "prop-types";
|
|
10
|
+
import { Keys as u, classNames as S, IconWrap as B, WatermarkOverlay as J, getLicenseMessage as Q, canUseDOM as V, validatePackage as X, createPropsContext as Z, withIdHOC as ee, withPropsContext as te, withAdaptiveModeContext as se, kendoThemeMaps as ie } from "@progress/kendo-react-common";
|
|
11
11
|
import { plusIcon as oe } from "@progress/kendo-svg-icons";
|
|
12
12
|
import { FloatingLabel as ae } from "@progress/kendo-react-labels";
|
|
13
13
|
import ne from "../common/ListContainer.mjs";
|
|
@@ -15,180 +15,193 @@ import le from "../common/List.mjs";
|
|
|
15
15
|
import de from "../common/GroupStickyHeader.mjs";
|
|
16
16
|
import re from "./TagList.mjs";
|
|
17
17
|
import he from "../common/SearchBar.mjs";
|
|
18
|
-
import
|
|
18
|
+
import O from "../common/DropDownBase.mjs";
|
|
19
19
|
import { ActiveDescendant as w } from "../common/settings.mjs";
|
|
20
|
-
import { getFilteredData as
|
|
21
|
-
import { packageMetadata as
|
|
20
|
+
import { getFilteredData as x, areSame as P, removeDataItems as D, isPresent as _, getItemValue as K, preventDefaultNonInputs as pe, matchTags as z, itemIndexStartsWith as ce } from "../common/utils.mjs";
|
|
21
|
+
import { packageMetadata as A } from "../package-metadata.mjs";
|
|
22
22
|
import ue from "../common/ClearButton.mjs";
|
|
23
23
|
import { AdaptiveMode as fe } from "../common/AdaptiveMode.mjs";
|
|
24
24
|
import { ActionSheetContent as ge } from "@progress/kendo-react-layout";
|
|
25
25
|
import me from "../common/ListFilter.mjs";
|
|
26
|
-
import
|
|
27
|
-
const { sizeMap:
|
|
26
|
+
import H from "../common/withCustomComponent.mjs";
|
|
27
|
+
const { sizeMap: M, roundedMap: ve } = ie, be = "Please enter a valid value!", W = (E) => E.preventDefault(), $ = (E) => E === 2, C = class C extends g.Component {
|
|
28
28
|
constructor(n) {
|
|
29
29
|
super(n), this.state = {
|
|
30
30
|
activedescendant: w.PopupList,
|
|
31
31
|
currentValue: []
|
|
32
|
-
}, this._element = null, this._valueItemsDuringOnChange = null, this.base = new
|
|
32
|
+
}, this._element = null, this._valueItemsDuringOnChange = null, this.base = new O(this), this._tags = [], this._input = null, this._adaptiveInput = null, this._skipFocusEvent = !1, this._lastSelectedOrDeslectedItemIndex = null, this.itemHeight = 0, this.scrollToFocused = !1, this.showLicenseWatermark = !1, this.focus = () => {
|
|
33
33
|
this._input && this._input.focus();
|
|
34
34
|
}, this.handleItemSelect = (e, t) => {
|
|
35
|
-
const { dataItemKey:
|
|
36
|
-
this._lastSelectedOrDeslectedItemIndex =
|
|
37
|
-
let
|
|
38
|
-
r !== -1 ? (
|
|
35
|
+
const { dataItemKey: o, virtual: s } = this.props, a = x(this.props), i = s ? s.skip : 0, p = a[e - i], r = this.value.findIndex((h) => P(h, p, o));
|
|
36
|
+
this._lastSelectedOrDeslectedItemIndex = a.findIndex((h) => P(h, p, o));
|
|
37
|
+
let d = [];
|
|
38
|
+
r !== -1 ? (d = this.value, d.splice(r, 1)) : d = [...this.value, p], (this.props.filter !== void 0 ? this.props.filter : this.state.text) && !this.mobileMode && (this.state.text && (t.data.text = ""), this.base.filterChanged("", t)), this._adaptiveInput && this._adaptiveInput.blur(), this.state.focusedIndex !== void 0 && (t.data.focusedIndex = void 0), this.triggerOnChange(d, t), this.base.triggerPageChangeCornerItems(p, t);
|
|
39
39
|
}, this.onTagDelete = (e, t) => {
|
|
40
|
-
const
|
|
41
|
-
|
|
40
|
+
const o = this.base.initState();
|
|
41
|
+
o.syntheticEvent = t, this.opened && this.base.togglePopup(o), !this.state.focused && !this.mobileMode && (o.data.focused = !0, this.focus());
|
|
42
42
|
const s = this.value;
|
|
43
|
-
|
|
43
|
+
D(s, e, this.props.dataItemKey), this.triggerOnChange(s, o), this.applyState(o);
|
|
44
44
|
}, this.itemFocus = (e, t) => {
|
|
45
|
-
const { allowCustom:
|
|
46
|
-
|
|
45
|
+
const { allowCustom: o, virtual: s } = this.props, a = x(this.props), i = s ? s.skip : 0, p = s ? s.pageSize : 0, r = this.props.filter !== void 0 ? this.props.filter : this.state.text, { focusedIndex: d } = this.getFocusedState(), l = o && r, h = a[e - i];
|
|
46
|
+
if (s && !h && e >= 0 && d !== e) {
|
|
47
|
+
const f = Math.floor(e / p) * p;
|
|
48
|
+
if (f !== i) {
|
|
49
|
+
this.state.focusedIndex !== e && (t.data.focusedIndex = e, t.data.activedescendant = w.PopupList), this.base.triggerOnPageChange(t, f, p);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
h && d !== e ? this.state.focusedIndex !== e && (t.data.focusedIndex = e, t.data.activedescendant = w.PopupList) : l && e === -1 && this.state.focusedIndex !== void 0 && (t.data.focusedIndex = void 0), this.base.triggerPageChangeCornerItems(h, t);
|
|
47
54
|
}, this.componentRef = (e) => {
|
|
48
55
|
this._element = e, this.base.wrapper = e;
|
|
49
56
|
}, this.searchbarRef = (e) => {
|
|
50
57
|
const t = this._input = e && e.input;
|
|
51
58
|
t && this.state.focused && window.setTimeout(() => t.focus(), 0);
|
|
52
59
|
}, this.onChangeHandler = (e) => {
|
|
53
|
-
const t = this.base.initState(),
|
|
54
|
-
t.syntheticEvent = e, this.props.filter === void 0 && (t.data.text =
|
|
60
|
+
const t = this.base.initState(), o = e.target.value;
|
|
61
|
+
t.syntheticEvent = e, this.props.filter === void 0 && (t.data.text = o), t.data.focusedIndex = void 0, this.opened ? this.scrollToFocused = !0 : (this.base.togglePopup(t), this.setState({ currentValue: this.value })), this.base.filterChanged(o, t), this.applyState(t), this.setState({ group: void 0 });
|
|
55
62
|
}, this.clearButtonClick = (e) => {
|
|
56
63
|
const t = this.base.initState();
|
|
57
64
|
t.syntheticEvent = e, e.stopPropagation(), this.value.length > 0 && this.triggerOnChange([], t), this.state.focusedIndex !== void 0 && (t.data.focusedIndex = void 0), this.opened && this.base.togglePopup(t);
|
|
58
|
-
const
|
|
59
|
-
|
|
65
|
+
const o = this.props.filter !== void 0 ? this.props.filter : this.state.text;
|
|
66
|
+
_(o) && o !== "" && this.base.filterChanged("", t), this.state.text && (t.data.text = ""), this._lastSelectedOrDeslectedItemIndex = null, this.applyState(t);
|
|
60
67
|
}, this.onInputKeyDown = (e) => {
|
|
61
|
-
const { textField: t, groupField:
|
|
62
|
-
if (
|
|
63
|
-
return this.onTagsNavigate(e,
|
|
64
|
-
const
|
|
65
|
-
e.preventDefault(), this.base.togglePopup(
|
|
68
|
+
const { textField: t, groupField: o, virtual: s } = this.props, a = x(this.props), i = e.keyCode, p = this.props.filter !== void 0 ? this.props.filter : this.state.text, r = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { focusedItem: d, focusedIndex: l } = this.getFocusedState(), h = this.base.initState();
|
|
69
|
+
if (h.syntheticEvent = e, !p && this.value.length > 0 && (i === u.left || i === u.right || i === u.home || i === u.end || i === u.delete || i === u.backspace) && !e.shiftKey)
|
|
70
|
+
return this.onTagsNavigate(e, h);
|
|
71
|
+
const f = () => {
|
|
72
|
+
e.preventDefault(), this.base.togglePopup(h), this.applyState(h);
|
|
66
73
|
};
|
|
67
74
|
if (this.opened)
|
|
68
|
-
if (
|
|
75
|
+
if (i === u.pageUp)
|
|
69
76
|
e.preventDefault(), this.base.scrollPopupByPageSize(-1);
|
|
70
|
-
else if (
|
|
77
|
+
else if (i === u.pageDown)
|
|
71
78
|
e.preventDefault(), this.base.scrollPopupByPageSize(1);
|
|
72
79
|
else if ((e.ctrlKey || e.metaKey) && e.code === "KeyA") {
|
|
73
|
-
const
|
|
74
|
-
this.updateStateOnKeyboardNavigation(
|
|
80
|
+
const b = (this.state.value && this.state.value.length) === a.length ? [] : a;
|
|
81
|
+
this.updateStateOnKeyboardNavigation(b, h);
|
|
75
82
|
} else if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.keyCode === u.end) {
|
|
76
|
-
const
|
|
77
|
-
this.itemFocus(
|
|
83
|
+
const c = a.slice(this.getFocusedState().focusedIndex);
|
|
84
|
+
this.itemFocus(a.length - 1, h), this.updateStateOnKeyboardNavigation(c, h);
|
|
78
85
|
} else if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.keyCode === u.home) {
|
|
79
|
-
const
|
|
80
|
-
this.itemFocus(0,
|
|
86
|
+
const c = a.slice(0, this.getFocusedState().focusedIndex + 1);
|
|
87
|
+
this.itemFocus(0, h), this.updateStateOnKeyboardNavigation(c, h);
|
|
81
88
|
} else if (e.shiftKey && e.keyCode === u.up) {
|
|
82
|
-
let
|
|
83
|
-
const
|
|
84
|
-
|
|
89
|
+
let c;
|
|
90
|
+
const b = this.getLastSelectedOrDeselectedIndex(1, l);
|
|
91
|
+
b === null ? c = l !== 0 ? a.slice(l - 1, l) : [a[l]] : b === l ? c = [a[b - 1]] : l >= 0 && (c = b > l ? a.slice(l - 1, b) : a.slice(b - 1, l)), c && c.length > 0 && (l >= 1 && this.itemFocus(l - 1, h), this.updateStateOnKeyboardNavigation(c, h));
|
|
85
92
|
} else if (e.shiftKey && e.keyCode === u.down) {
|
|
86
|
-
let
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
} else if (e.altKey &&
|
|
90
|
-
|
|
91
|
-
else if (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
let c;
|
|
94
|
+
const b = this.getLastSelectedOrDeselectedIndex(0, l);
|
|
95
|
+
b === null ? c = l !== a.length - 1 ? a.slice(l, l + 1) : [a[l]] : b === l ? c = a.slice(l, l + 2) : l >= 0 && (c = b > l ? a.slice(l + 1, b + 1) : a.slice(b, l + 2)), c && c.length >= 1 && (this.itemFocus(l + 1, h), this.updateStateOnKeyboardNavigation(c, h));
|
|
96
|
+
} else if (e.altKey && i === u.up)
|
|
97
|
+
f();
|
|
98
|
+
else if (i === u.up || i === u.down) {
|
|
99
|
+
const c = s ? s.skip : 0, b = l - c;
|
|
100
|
+
if (o !== "" && t)
|
|
101
|
+
if (!this.props.skipDisabledItems && r)
|
|
102
|
+
this.onNavigate(h, i);
|
|
95
103
|
else {
|
|
96
|
-
let
|
|
97
|
-
if (
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
} else if (
|
|
101
|
-
let
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
+
let m = 0;
|
|
105
|
+
if (i === u.down || i === u.right) {
|
|
106
|
+
const y = a.slice(b + 1).find((I) => !I.disabled && I[t]);
|
|
107
|
+
m = y && a.findIndex((I) => I[t] === y[t]), m && m !== -1 && (m = m + c);
|
|
108
|
+
} else if (i === u.up || i === u.left) {
|
|
109
|
+
let y;
|
|
110
|
+
if (l === -1)
|
|
111
|
+
y = a, m = a.findIndex((I) => !I.disabled && I[t]), m !== -1 && (m = m + c);
|
|
104
112
|
else {
|
|
105
|
-
|
|
106
|
-
let
|
|
107
|
-
for (;
|
|
108
|
-
|
|
109
|
-
|
|
113
|
+
y = a.slice(0, b);
|
|
114
|
+
let I = y.pop();
|
|
115
|
+
for (; I && I.disabled; )
|
|
116
|
+
I = y.pop();
|
|
117
|
+
m = I && a.findIndex((T) => T[t] === I[t]), m && m !== -1 && (m = m + c);
|
|
110
118
|
}
|
|
111
119
|
}
|
|
112
|
-
if (
|
|
113
|
-
const
|
|
114
|
-
this.onNavigate(
|
|
115
|
-
} else
|
|
120
|
+
if (m) {
|
|
121
|
+
const y = m - l;
|
|
122
|
+
this.onNavigate(h, i, y);
|
|
123
|
+
} else
|
|
124
|
+
this.onNavigate(h, i);
|
|
116
125
|
}
|
|
117
|
-
else if (!this.props.skipDisabledItems &&
|
|
118
|
-
this.onNavigate(
|
|
126
|
+
else if (!this.props.skipDisabledItems && r)
|
|
127
|
+
this.onNavigate(h, i);
|
|
119
128
|
else {
|
|
120
|
-
let
|
|
121
|
-
if (
|
|
122
|
-
|
|
123
|
-
else if (
|
|
124
|
-
const
|
|
125
|
-
for (
|
|
126
|
-
|
|
129
|
+
let m = null;
|
|
130
|
+
if (i === u.down || i === u.right)
|
|
131
|
+
m = a.slice(b + 1).find((y) => !y.disabled);
|
|
132
|
+
else if (i === u.up || i === u.left) {
|
|
133
|
+
const y = a.slice(0, b);
|
|
134
|
+
for (m = y.pop(); m && m.disabled; )
|
|
135
|
+
m = y.pop();
|
|
127
136
|
}
|
|
128
|
-
if (
|
|
129
|
-
const
|
|
130
|
-
|
|
137
|
+
if (m) {
|
|
138
|
+
const y = a.indexOf(m);
|
|
139
|
+
if (y !== -1) {
|
|
140
|
+
const I = c + y - l;
|
|
141
|
+
this.onNavigate(h, i, I);
|
|
142
|
+
} else
|
|
143
|
+
this.onNavigate(h, i);
|
|
131
144
|
} else
|
|
132
|
-
this.onNavigate(
|
|
145
|
+
this.onNavigate(h, i);
|
|
133
146
|
}
|
|
134
|
-
this.applyState(
|
|
135
|
-
} else
|
|
136
|
-
else e.altKey &&
|
|
147
|
+
this.applyState(h), e.preventDefault();
|
|
148
|
+
} else i === u.enter ? (e.preventDefault(), this.props.allowCustom && p && d === null ? this.customItemSelect(e) : d && d.disabled ? f() : this.selectFocusedItem(e)) : i === u.esc && f();
|
|
149
|
+
else e.altKey && i === u.down ? f() : i === u.esc && this.clearButtonClick(e);
|
|
137
150
|
}, this.listContainerContent = () => {
|
|
138
|
-
const { header: e, footer: t, allowCustom:
|
|
151
|
+
const { header: e, footer: t, allowCustom: o, size: s, groupStickyHeaderItemRender: a, groupField: i, list: p } = this.props, r = x(this.props), d = this.props.filter !== void 0 ? this.props.filter : this.state.text, { focusedType: l } = this.getFocusedState(), h = o && d && /* @__PURE__ */ g.createElement(
|
|
139
152
|
"div",
|
|
140
153
|
{
|
|
141
|
-
className:
|
|
142
|
-
[`k-list-${
|
|
154
|
+
className: S("k-list", {
|
|
155
|
+
[`k-list-${M[s] || s}`]: s
|
|
143
156
|
}),
|
|
144
157
|
key: "customitem",
|
|
145
158
|
onClick: this.customItemSelect,
|
|
146
|
-
onMouseDown:
|
|
159
|
+
onMouseDown: W
|
|
147
160
|
},
|
|
148
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ g.createElement(
|
|
149
162
|
"div",
|
|
150
163
|
{
|
|
151
|
-
className:
|
|
164
|
+
className: S("k-list-item k-custom-item", { "k-focus": $(l) }),
|
|
152
165
|
style: { fontStyle: "italic" }
|
|
153
166
|
},
|
|
154
|
-
|
|
155
|
-
/* @__PURE__ */
|
|
167
|
+
d,
|
|
168
|
+
/* @__PURE__ */ g.createElement(B, { name: "plus", icon: oe, style: { position: "absolute", right: "0.5em" } })
|
|
156
169
|
)
|
|
157
170
|
);
|
|
158
|
-
let { group:
|
|
159
|
-
return
|
|
171
|
+
let { group: f } = this.state;
|
|
172
|
+
return f === void 0 && i !== void 0 && (f = K(r[0], i)), /* @__PURE__ */ g.createElement(g.Fragment, null, e && /* @__PURE__ */ g.createElement("div", { className: "k-list-header" }, e), h, /* @__PURE__ */ g.createElement(
|
|
160
173
|
"div",
|
|
161
174
|
{
|
|
162
|
-
className:
|
|
163
|
-
[`k-list-${this.mobileMode ? "lg" :
|
|
175
|
+
className: S("k-list", {
|
|
176
|
+
[`k-list-${this.mobileMode ? "lg" : M[s] || s}`]: s,
|
|
164
177
|
"k-virtual-list": this.base.vs.enabled
|
|
165
178
|
})
|
|
166
179
|
},
|
|
167
|
-
!
|
|
180
|
+
!p && f && r.length !== 0 && /* @__PURE__ */ g.createElement(de, { group: f, groupMode: "modern", render: a }),
|
|
168
181
|
this.renderList()
|
|
169
|
-
), this.showLicenseWatermark && /* @__PURE__ */
|
|
182
|
+
), this.showLicenseWatermark && /* @__PURE__ */ g.createElement(J, { message: this.licenseMessage }), t && /* @__PURE__ */ g.createElement("div", { className: "k-list-footer" }, t));
|
|
170
183
|
}, this.renderListContainer = () => {
|
|
171
|
-
const e = this.base, { dir: t } = this.props,
|
|
184
|
+
const e = this.base, { dir: t } = this.props, o = x(this.props), s = this.base.getPopupSettings(), a = s.width !== void 0 ? s.width : e.popupWidth, i = {
|
|
172
185
|
dir: t !== void 0 ? t : e.dirCalculated,
|
|
173
|
-
width:
|
|
186
|
+
width: a,
|
|
174
187
|
popupSettings: {
|
|
175
188
|
...s,
|
|
176
|
-
popupClass:
|
|
189
|
+
popupClass: S(s.popupClass, "k-list-container", "k-multiselect-popup"),
|
|
177
190
|
anchor: s.anchor || this.element,
|
|
178
191
|
show: this.opened,
|
|
179
192
|
onOpen: this.onPopupOpened,
|
|
180
193
|
onClose: this.onPopupClosed
|
|
181
194
|
},
|
|
182
|
-
itemsCount: [
|
|
195
|
+
itemsCount: [o.length, this.value.length]
|
|
183
196
|
};
|
|
184
|
-
return /* @__PURE__ */
|
|
197
|
+
return /* @__PURE__ */ g.createElement(ne, { ...i }, this.listContainerContent());
|
|
185
198
|
}, this.renderAdaptiveListContainer = () => {
|
|
186
|
-
const { adaptiveTitle: e, adaptiveSubtitle: t, filterable:
|
|
199
|
+
const { adaptiveTitle: e, adaptiveSubtitle: t, filterable: o, filter: s } = this.props, { windowWidth: a = 0 } = this.state, i = s !== void 0 ? s : this.state.text, p = o ? /* @__PURE__ */ g.createElement(
|
|
187
200
|
me,
|
|
188
201
|
{
|
|
189
|
-
value:
|
|
190
|
-
ref: (
|
|
191
|
-
this._adaptiveInput =
|
|
202
|
+
value: i,
|
|
203
|
+
ref: (d) => {
|
|
204
|
+
this._adaptiveInput = d && d.element;
|
|
192
205
|
},
|
|
193
206
|
onChange: this.onChangeHandler,
|
|
194
207
|
onKeyDown: this.onInputKeyDown,
|
|
@@ -201,101 +214,101 @@ const { sizeMap: D, roundedMap: ve } = ie, be = "Please enter a valid value!", H
|
|
|
201
214
|
title: e || this.props.label,
|
|
202
215
|
subTitle: t,
|
|
203
216
|
expand: this.opened,
|
|
204
|
-
onClose: (
|
|
205
|
-
windowWidth:
|
|
206
|
-
mobileFilter:
|
|
217
|
+
onClose: (d) => this.closePopup(d),
|
|
218
|
+
windowWidth: a,
|
|
219
|
+
mobileFilter: p
|
|
207
220
|
};
|
|
208
|
-
return /* @__PURE__ */
|
|
221
|
+
return /* @__PURE__ */ g.createElement(fe, { ...r }, /* @__PURE__ */ g.createElement(ge, null, /* @__PURE__ */ g.createElement("div", { className: "k-list-container" }, this.listContainerContent())));
|
|
209
222
|
}, this.closePopup = (e) => {
|
|
210
223
|
const t = this.base.initState();
|
|
211
224
|
t.syntheticEvent = e, e.stopPropagation(), this.state.focusedIndex !== void 0 && (t.data.focusedIndex = void 0), this.opened && this.base.togglePopup(t), t.events.push({ type: "onClose" });
|
|
212
|
-
const
|
|
213
|
-
|
|
225
|
+
const o = this.props.filter !== void 0 ? this.props.filter : this.state.text;
|
|
226
|
+
_(o) && o !== "" && this.base.filterChanged("", t), this.state.text && (t.data.text = ""), this.applyState(t);
|
|
214
227
|
}, this.onCancel = (e) => {
|
|
215
228
|
const t = this.base.initState();
|
|
216
229
|
t.syntheticEvent = e, e.stopPropagation(), this.state.focusedIndex !== void 0 && (t.data.focusedIndex = void 0), this.opened && this.base.togglePopup(t), t.events.push({ type: "onCancel" });
|
|
217
|
-
const
|
|
218
|
-
|
|
230
|
+
const o = this.props.filter !== void 0 ? this.props.filter : this.state.text;
|
|
231
|
+
_(o) && o !== "" && this.base.filterChanged("", t), this.state.text && (t.data.text = ""), this.applyState(t);
|
|
219
232
|
}, this.renderList = () => {
|
|
220
233
|
const {
|
|
221
234
|
textField: e,
|
|
222
235
|
listNoDataRender: t,
|
|
223
|
-
itemRender:
|
|
236
|
+
itemRender: o,
|
|
224
237
|
groupHeaderItemRender: s,
|
|
225
|
-
dataItemKey:
|
|
226
|
-
virtual:
|
|
227
|
-
} = this.props,
|
|
228
|
-
return /* @__PURE__ */
|
|
238
|
+
dataItemKey: a,
|
|
239
|
+
virtual: i = { skip: 0, total: void 0 }
|
|
240
|
+
} = this.props, p = x(this.props), r = this.base.vs, { focusedIndex: d } = this.getFocusedState(), l = this.base.getPopupSettings(), h = `translateY(${r.translate}px)`;
|
|
241
|
+
return /* @__PURE__ */ g.createElement(
|
|
229
242
|
le,
|
|
230
243
|
{
|
|
231
244
|
id: this.base.listBoxId,
|
|
232
245
|
show: this.opened,
|
|
233
|
-
data:
|
|
234
|
-
focusedIndex:
|
|
246
|
+
data: p.slice(),
|
|
247
|
+
focusedIndex: d - i.skip,
|
|
235
248
|
value: this.value,
|
|
236
249
|
textField: e,
|
|
237
|
-
valueField:
|
|
250
|
+
valueField: a,
|
|
238
251
|
optionsGuid: this.base.guid,
|
|
239
252
|
groupField: this.props.groupField,
|
|
240
253
|
groupMode: "modern",
|
|
241
|
-
listRef: (
|
|
242
|
-
r.list = this.base.list =
|
|
254
|
+
listRef: (f) => {
|
|
255
|
+
r.list = this.base.list = f;
|
|
243
256
|
},
|
|
244
257
|
wrapperStyle: this.mobileMode ? {} : { maxHeight: l.height },
|
|
245
258
|
wrapperCssClass: "k-list-content",
|
|
246
|
-
listStyle: r.enabled ? { transform:
|
|
259
|
+
listStyle: r.enabled ? { transform: h } : void 0,
|
|
247
260
|
key: "listKey",
|
|
248
|
-
skip:
|
|
261
|
+
skip: i.skip,
|
|
249
262
|
onClick: this.handleItemClick,
|
|
250
|
-
itemRender:
|
|
263
|
+
itemRender: o,
|
|
251
264
|
groupHeaderItemRender: s,
|
|
252
265
|
noDataRender: t,
|
|
253
|
-
onMouseDown:
|
|
266
|
+
onMouseDown: W,
|
|
254
267
|
onBlur: this.handleBlur,
|
|
255
268
|
onScroll: this.onScroll,
|
|
256
269
|
wrapperRef: r.scrollerRef,
|
|
257
270
|
scroller: this.base.renderScrollElement(),
|
|
258
|
-
ariaSetSize:
|
|
271
|
+
ariaSetSize: i.total
|
|
259
272
|
}
|
|
260
273
|
);
|
|
261
274
|
}, this.onScroll = (e) => {
|
|
262
|
-
const { vs: t, list:
|
|
275
|
+
const { vs: t, list: o } = this.base;
|
|
263
276
|
t.scrollHandler(e);
|
|
264
277
|
const { groupField: s } = this.props;
|
|
265
|
-
let
|
|
266
|
-
if (!(!s || !
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
let
|
|
270
|
-
for (let l = 1; l <
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
group:
|
|
278
|
+
let a = x(this.props);
|
|
279
|
+
if (!(!s || !a.length) && s) {
|
|
280
|
+
const i = this.itemHeight = this.itemHeight || (t.enabled ? t.itemHeight : o ? o.children[0].offsetHeight : 0), r = e.target.scrollTop - t.skip * i;
|
|
281
|
+
a = this.base.getGroupedDataModernMode(a, s);
|
|
282
|
+
let d = a[0][s];
|
|
283
|
+
for (let l = 1; l < a.length && !(i * l > r); l++)
|
|
284
|
+
a[l] && a[l][s] && (d = a[l][s]);
|
|
285
|
+
d !== this.state.group && this.setState({
|
|
286
|
+
group: d
|
|
274
287
|
});
|
|
275
288
|
}
|
|
276
289
|
}, this.customItemSelect = (e) => {
|
|
277
|
-
const t = this.props.filter !== void 0 ? this.props.filter : this.state.text, { textField:
|
|
290
|
+
const t = this.props.filter !== void 0 ? this.props.filter : this.state.text, { textField: o } = this.props;
|
|
278
291
|
if (!t)
|
|
279
292
|
return;
|
|
280
293
|
const s = this.base.initState();
|
|
281
294
|
s.syntheticEvent = e;
|
|
282
|
-
const
|
|
295
|
+
const a = o ? { [o]: t } : t;
|
|
283
296
|
this.state.text !== void 0 && (s.data.text = ""), s.data.focusedIndex = void 0, this.base.filterChanged("", s);
|
|
284
|
-
const
|
|
285
|
-
this.triggerOnChange(
|
|
297
|
+
const i = [...this.value, a];
|
|
298
|
+
this.triggerOnChange(i, s), this.base.togglePopup(s), this.applyState(s);
|
|
286
299
|
}, this.handleWrapperClick = (e) => {
|
|
287
300
|
const t = this._input;
|
|
288
301
|
!this.opened && t && this.focusElement(t);
|
|
289
|
-
const
|
|
290
|
-
|
|
302
|
+
const o = this.base.initState();
|
|
303
|
+
o.syntheticEvent = e, !this.state.focused && !this.mobileMode && (o.events.push({ type: "onFocus" }), o.data.focused = !0), this.mobileMode && (this.setState({ currentValue: this.tagsToRender }), this.mobileMode && window.setTimeout(() => this._adaptiveInput && this._adaptiveInput.focus(), 300)), this.base.togglePopup(o), this.applyState(o);
|
|
291
304
|
}, this.handleItemClick = (e, t) => {
|
|
292
|
-
const
|
|
293
|
-
|
|
305
|
+
const o = this.base.initState();
|
|
306
|
+
o.syntheticEvent = t, this.handleItemSelect(e, o), this.props.autoClose && this.base.togglePopup(o), t.stopPropagation(), this.applyState(o);
|
|
294
307
|
}, this.handleBlur = (e) => {
|
|
295
308
|
if (!this.state.focused || this._skipFocusEvent)
|
|
296
309
|
return;
|
|
297
|
-
const t = this.base.initState(), { allowCustom:
|
|
298
|
-
t.syntheticEvent = e, t.data.focused = !1, t.events.push({ type: "onBlur" }), this.opened && !this.mobileMode && (this.state.opened && (t.data.opened = !1), t.events.push({ type: "onClose" })), !
|
|
310
|
+
const t = this.base.initState(), { allowCustom: o, filterable: s } = this.props;
|
|
311
|
+
t.syntheticEvent = e, t.data.focused = !1, t.events.push({ type: "onBlur" }), this.opened && !this.mobileMode && (this.state.opened && (t.data.opened = !1), t.events.push({ type: "onClose" })), !o && !s && this.state.text && (t.data.text = ""), this.applyState(t);
|
|
299
312
|
}, this.handleFocus = (e) => {
|
|
300
313
|
this._skipFocusEvent || this.base.handleFocus(e);
|
|
301
314
|
}, this.onPopupOpened = () => {
|
|
@@ -308,19 +321,19 @@ const { sizeMap: D, roundedMap: ve } = ie, be = "Please enter a valid value!", H
|
|
|
308
321
|
this._input && this._input.setCustomValidity && this._input.setCustomValidity(
|
|
309
322
|
this.validity.valid ? "" : this.props.validationMessage || be
|
|
310
323
|
);
|
|
311
|
-
}, this.validate(n), this.licenseMessage = Q(
|
|
324
|
+
}, this.validate(n), this.licenseMessage = Q(A);
|
|
312
325
|
}
|
|
313
326
|
get _inputId() {
|
|
314
327
|
return this.props.id;
|
|
315
328
|
}
|
|
316
329
|
get document() {
|
|
317
|
-
if (
|
|
330
|
+
if (V)
|
|
318
331
|
return this.element && this.element.ownerDocument || document;
|
|
319
332
|
}
|
|
320
333
|
validate(n) {
|
|
321
334
|
if (n.filterable || n.virtual) {
|
|
322
335
|
const e = [];
|
|
323
|
-
n.filterable && e.push("filterable"), n.virtual && e.push("virtualization"), this.showLicenseWatermark = !X(
|
|
336
|
+
n.filterable && e.push("filterable"), n.virtual && e.push("virtualization"), this.showLicenseWatermark = !X(A, {
|
|
324
337
|
component: "MultiSelect",
|
|
325
338
|
features: e
|
|
326
339
|
});
|
|
@@ -337,8 +350,8 @@ const { sizeMap: D, roundedMap: ve } = ie, be = "Please enter a valid value!", H
|
|
|
337
350
|
/** @hidden */
|
|
338
351
|
get tagsToRender() {
|
|
339
352
|
const { tags: n, textField: e } = this.props, t = [];
|
|
340
|
-
return n === void 0 ? this.value.forEach((
|
|
341
|
-
t.push({ text:
|
|
353
|
+
return n === void 0 ? this.value.forEach((o) => {
|
|
354
|
+
t.push({ text: K(o, e), data: [o] });
|
|
342
355
|
}) : t.push(...n), t;
|
|
343
356
|
}
|
|
344
357
|
/**
|
|
@@ -374,27 +387,27 @@ const { sizeMap: D, roundedMap: ve } = ie, be = "Please enter a valid value!", H
|
|
|
374
387
|
}
|
|
375
388
|
/** @hidden */
|
|
376
389
|
get required() {
|
|
377
|
-
return this.props.required !== void 0 ? this.props.required :
|
|
390
|
+
return this.props.required !== void 0 ? this.props.required : C.defaultProps.required;
|
|
378
391
|
}
|
|
379
392
|
get validityStyles() {
|
|
380
|
-
return this.props.validityStyles !== void 0 ? this.props.validityStyles :
|
|
393
|
+
return this.props.validityStyles !== void 0 ? this.props.validityStyles : C.defaultProps.validityStyles;
|
|
381
394
|
}
|
|
382
395
|
/** @hidden */
|
|
383
396
|
componentDidUpdate(n, e) {
|
|
384
|
-
var
|
|
385
|
-
const { virtual: t, groupField:
|
|
386
|
-
if (this.validate(this.props), this.base.didUpdate(), !l.animate &&
|
|
397
|
+
var h;
|
|
398
|
+
const { virtual: t, groupField: o = "" } = this.props, s = x(this.props), a = t ? t.skip : 0, i = n.virtual ? n.virtual.total : 0, p = n.opened !== void 0 ? n.opened : e.opened, r = !p && this.opened, d = p && !this.opened, l = this.base.getPopupSettings();
|
|
399
|
+
if (this.validate(this.props), this.base.didUpdate(), !l.animate && d && this.onPopupClosed(), t && t.total !== i)
|
|
387
400
|
this.base.vs.calcScrollElementHeight(), this.base.vs.reset();
|
|
388
401
|
else {
|
|
389
|
-
let { focusedItem:
|
|
390
|
-
|
|
402
|
+
let { focusedItem: f, focusedIndex: c } = this.getFocusedState();
|
|
403
|
+
o !== "" && (c = (h = this.base.getGroupedDataModernMode(s, o)) == null ? void 0 : h.indexOf(f)), r && t ? this.base.scrollToVirtualItem(t, c - a) : r && !t ? (s && s.length !== 0 && this.base.resetGroupStickyHeader(s[0][o], this), this.base.scrollToItem(c)) : this.opened && p && f && this.scrollToFocused && this.base.scrollToItem(c - a);
|
|
391
404
|
}
|
|
392
405
|
this.scrollToFocused = !1, this.setValidity();
|
|
393
406
|
}
|
|
394
407
|
/** @hidden */
|
|
395
408
|
componentDidMount() {
|
|
396
409
|
var n;
|
|
397
|
-
this.observerResize =
|
|
410
|
+
this.observerResize = V && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this)), this.base.didMount(), this.setValidity(), (n = this.document) != null && n.body && this.observerResize && this.observerResize.observe(this.document.body);
|
|
398
411
|
}
|
|
399
412
|
/** @hidden */
|
|
400
413
|
componentWillUnmount() {
|
|
@@ -403,18 +416,18 @@ const { sizeMap: D, roundedMap: ve } = ie, be = "Please enter a valid value!", H
|
|
|
403
416
|
}
|
|
404
417
|
/** @hidden */
|
|
405
418
|
onNavigate(n, e, t) {
|
|
406
|
-
const { allowCustom:
|
|
407
|
-
if (this.opened && e === u.up &&
|
|
419
|
+
const { allowCustom: o } = this.props, s = x(this.props), a = this.props.filter !== void 0 ? this.props.filter : this.state.text, { focusedType: i, focusedIndex: p } = this.getFocusedState(), r = o && a, d = $(i), l = this.base, h = l.vs;
|
|
420
|
+
if (this.opened && e === u.up && d)
|
|
408
421
|
this.state.focusedIndex !== void 0 && (n.data.focusedIndex = void 0);
|
|
409
422
|
else {
|
|
410
|
-
const
|
|
423
|
+
const f = l.navigation.navigate({
|
|
411
424
|
keyCode: e,
|
|
412
|
-
current:
|
|
413
|
-
max: (
|
|
425
|
+
current: p,
|
|
426
|
+
max: (h.enabled ? h.total : s.length) - 1,
|
|
414
427
|
min: r ? -1 : 0,
|
|
415
428
|
skipItems: t || void 0
|
|
416
429
|
});
|
|
417
|
-
|
|
430
|
+
f !== void 0 && (this.itemFocus(f, n), this.scrollToFocused = !0);
|
|
418
431
|
}
|
|
419
432
|
this.applyState(n);
|
|
420
433
|
}
|
|
@@ -424,92 +437,92 @@ const { sizeMap: D, roundedMap: ve } = ie, be = "Please enter a valid value!", H
|
|
|
424
437
|
style: n,
|
|
425
438
|
className: e,
|
|
426
439
|
label: t,
|
|
427
|
-
dir:
|
|
440
|
+
dir: o,
|
|
428
441
|
disabled: s,
|
|
429
|
-
textField:
|
|
430
|
-
dataItemKey:
|
|
431
|
-
virtual:
|
|
442
|
+
textField: a,
|
|
443
|
+
dataItemKey: i,
|
|
444
|
+
virtual: p,
|
|
432
445
|
size: r,
|
|
433
|
-
rounded:
|
|
446
|
+
rounded: d,
|
|
434
447
|
fillMode: l,
|
|
435
|
-
loading:
|
|
436
|
-
filter:
|
|
437
|
-
} = this.props, { text:
|
|
438
|
-
|
|
439
|
-
const
|
|
448
|
+
loading: h,
|
|
449
|
+
filter: f
|
|
450
|
+
} = this.props, { text: c, focused: b, focusedTag: m, currentValue: y } = this.state, I = this.base.vs, T = this.props.id || this._inputId;
|
|
451
|
+
I.enabled = p !== void 0, p !== void 0 && (I.skip = p.skip, I.total = p.total, I.pageSize = p.pageSize);
|
|
452
|
+
const k = this.mobileMode && this.opened ? y : this.tagsToRender;
|
|
440
453
|
this.setItems(this.tagsToRender, this._tags);
|
|
441
|
-
const
|
|
454
|
+
const R = !this.validityStyles || this.validity.valid, q = !!(f !== void 0 ? f : c) || k && k.length > 0, [G, U] = H(this.props.prefix || g.Fragment), [j, Y] = H(this.props.suffix || g.Fragment), L = /* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement(
|
|
442
455
|
"div",
|
|
443
456
|
{
|
|
444
457
|
ref: this.componentRef,
|
|
445
|
-
className:
|
|
446
|
-
[`k-input-${
|
|
447
|
-
[`k-rounded-${ve[
|
|
458
|
+
className: S("k-multiselect k-input", e, {
|
|
459
|
+
[`k-input-${M[r] || r}`]: r,
|
|
460
|
+
[`k-rounded-${ve[d] || d}`]: d,
|
|
448
461
|
[`k-input-${l}`]: l,
|
|
449
|
-
"k-focus":
|
|
450
|
-
"k-invalid": !
|
|
462
|
+
"k-focus": b && !s,
|
|
463
|
+
"k-invalid": !R,
|
|
451
464
|
"k-disabled": s,
|
|
452
|
-
"k-loading":
|
|
465
|
+
"k-loading": h,
|
|
453
466
|
"k-required": this.required
|
|
454
467
|
}),
|
|
455
468
|
style: t ? { ...n, width: void 0 } : n,
|
|
456
|
-
dir:
|
|
457
|
-
onFocus: (
|
|
458
|
-
this.mobileMode ? this.handleWrapperClick(
|
|
469
|
+
dir: o,
|
|
470
|
+
onFocus: (F) => {
|
|
471
|
+
this.mobileMode ? this.handleWrapperClick(F) : this.handleFocus(F);
|
|
459
472
|
},
|
|
460
473
|
onBlur: this.handleBlur,
|
|
461
474
|
onClick: this.handleWrapperClick,
|
|
462
475
|
onMouseDown: pe
|
|
463
476
|
},
|
|
464
|
-
this.props.prefix && /* @__PURE__ */
|
|
465
|
-
/* @__PURE__ */
|
|
477
|
+
this.props.prefix && /* @__PURE__ */ g.createElement(G, { ...U }),
|
|
478
|
+
/* @__PURE__ */ g.createElement("div", { className: S("k-input-values") }, /* @__PURE__ */ g.createElement(
|
|
466
479
|
"div",
|
|
467
480
|
{
|
|
468
|
-
className:
|
|
481
|
+
className: S("k-chip-list", { [`k-chip-list-${M[r] || r}`]: r }),
|
|
469
482
|
role: "listbox",
|
|
470
483
|
id: "tagslist-" + this.base.guid
|
|
471
484
|
},
|
|
472
|
-
|
|
485
|
+
k && k.length > 0 && /* @__PURE__ */ g.createElement(
|
|
473
486
|
re,
|
|
474
487
|
{
|
|
475
488
|
tagRender: this.props.tagRender,
|
|
476
489
|
onTagDelete: this.onTagDelete,
|
|
477
|
-
data:
|
|
490
|
+
data: k,
|
|
478
491
|
guid: this.base.guid,
|
|
479
|
-
focused:
|
|
492
|
+
focused: m ? k.find((F) => z(F, m, i)) : void 0,
|
|
480
493
|
size: r
|
|
481
494
|
}
|
|
482
495
|
)
|
|
483
|
-
), this.renderSearchBar(
|
|
484
|
-
|
|
485
|
-
this.props.suffix && /* @__PURE__ */
|
|
486
|
-
q && /* @__PURE__ */
|
|
496
|
+
), this.renderSearchBar(T)),
|
|
497
|
+
h && /* @__PURE__ */ g.createElement(B, { className: "k-input-loading-icon", name: "loading" }),
|
|
498
|
+
this.props.suffix && /* @__PURE__ */ g.createElement(j, { ...Y }),
|
|
499
|
+
q && /* @__PURE__ */ g.createElement(ue, { onClick: this.clearButtonClick }),
|
|
487
500
|
!this.mobileMode && this.renderListContainer()
|
|
488
501
|
), this.mobileMode && this.renderAdaptiveListContainer());
|
|
489
|
-
return t ? /* @__PURE__ */
|
|
502
|
+
return t ? /* @__PURE__ */ g.createElement(
|
|
490
503
|
ae,
|
|
491
504
|
{
|
|
492
505
|
label: t,
|
|
493
|
-
editorId:
|
|
494
|
-
editorValue:
|
|
495
|
-
editorValid:
|
|
506
|
+
editorId: T,
|
|
507
|
+
editorValue: c || K(this.value[0], a),
|
|
508
|
+
editorValid: R,
|
|
496
509
|
editorDisabled: s,
|
|
497
510
|
style: { width: n ? n.width : void 0 },
|
|
498
|
-
children:
|
|
511
|
+
children: L
|
|
499
512
|
}
|
|
500
|
-
) :
|
|
513
|
+
) : L;
|
|
501
514
|
}
|
|
502
515
|
renderSearchBar(n) {
|
|
503
|
-
const { activedescendant: e, focusedTag: t, currentValue:
|
|
516
|
+
const { activedescendant: e, focusedTag: t, currentValue: o } = this.state, { disabled: s, placeholder: a, ariaDescribedBy: i, ariaLabelledBy: p, ariaLabel: r, inputAttributes: d } = this.props, l = !this.mobileMode && (this.props.filter !== void 0 ? this.props.filter : this.state.text) || "", { focusedIndex: h } = this.getFocusedState(), f = this.value.length === 0 && !l ? a : void 0, c = o && o.length > 0 ? void 0 : a, b = e === w.TagsList && t !== void 0 ? `tag-${this.base.guid}-${t.text.replace(/\s+/g, "-")}` : `option-${this.base.guid}-${h}`, m = {
|
|
504
517
|
accessKey: this.props.accessKey,
|
|
505
518
|
tabIndex: this.props.tabIndex
|
|
506
519
|
};
|
|
507
|
-
return /* @__PURE__ */
|
|
520
|
+
return /* @__PURE__ */ g.createElement(
|
|
508
521
|
he,
|
|
509
522
|
{
|
|
510
523
|
id: n,
|
|
511
|
-
size: Math.max((
|
|
512
|
-
placeholder: this.mobileMode && this.opened ?
|
|
524
|
+
size: Math.max((f || "").length, l.length, 1),
|
|
525
|
+
placeholder: this.mobileMode && this.opened ? c : f,
|
|
513
526
|
value: l,
|
|
514
527
|
onChange: this.onChangeHandler,
|
|
515
528
|
onKeyDown: this.onInputKeyDown,
|
|
@@ -518,50 +531,50 @@ const { sizeMap: D, roundedMap: ve } = ie, be = "Please enter a valid value!", H
|
|
|
518
531
|
expanded: this.opened,
|
|
519
532
|
owns: this.base.listBoxId,
|
|
520
533
|
role: "combobox",
|
|
521
|
-
activedescendant:
|
|
522
|
-
ariaDescribedBy: `tagslist-${this.base.guid}${
|
|
523
|
-
ariaLabelledBy:
|
|
534
|
+
activedescendant: b,
|
|
535
|
+
ariaDescribedBy: `tagslist-${this.base.guid}${i ? " " + i : ""}`,
|
|
536
|
+
ariaLabelledBy: p,
|
|
524
537
|
ariaRequired: this.required,
|
|
525
538
|
ariaLabel: r,
|
|
526
|
-
inputAttributes:
|
|
527
|
-
...
|
|
539
|
+
inputAttributes: d,
|
|
540
|
+
...m
|
|
528
541
|
}
|
|
529
542
|
);
|
|
530
543
|
}
|
|
531
544
|
onTagsNavigate(n, e) {
|
|
532
|
-
const t = n.keyCode, { focusedTag:
|
|
533
|
-
let
|
|
534
|
-
const r =
|
|
545
|
+
const t = n.keyCode, { focusedTag: o } = this.state, s = this._tags, a = this.props.dataItemKey;
|
|
546
|
+
let i = o ? s.findIndex((d) => z(d, o, a)) : -1, p;
|
|
547
|
+
const r = i !== -1;
|
|
535
548
|
if (t === u.left)
|
|
536
|
-
r ?
|
|
549
|
+
r ? i = Math.max(0, i - 1) : i = s.length - 1, p = s[i];
|
|
537
550
|
else if (t === u.right)
|
|
538
|
-
|
|
551
|
+
i === s.length - 1 ? p = void 0 : r && (i = Math.min(s.length - 1, i + 1), p = s[i]);
|
|
539
552
|
else if (t === u.home && !n.shiftKey)
|
|
540
|
-
|
|
553
|
+
p = s[0];
|
|
541
554
|
else if (t === u.end && !n.shiftKey)
|
|
542
|
-
|
|
555
|
+
p = s[s.length - 1];
|
|
543
556
|
else if (t === u.delete) {
|
|
544
557
|
if (r) {
|
|
545
|
-
const
|
|
546
|
-
|
|
558
|
+
const d = this.value;
|
|
559
|
+
D(d, s[i].data, a), this.triggerOnChange(d, e);
|
|
547
560
|
}
|
|
548
561
|
} else if (t === u.backspace) {
|
|
549
|
-
const
|
|
562
|
+
const d = this.value;
|
|
550
563
|
if (r)
|
|
551
|
-
|
|
564
|
+
D(d, s[i].data, a), this.triggerOnChange(d, e);
|
|
552
565
|
else if (!r && s.length) {
|
|
553
566
|
const l = s.pop();
|
|
554
|
-
|
|
567
|
+
D(d, l.data, a), this.triggerOnChange(d, e);
|
|
555
568
|
}
|
|
556
569
|
}
|
|
557
|
-
|
|
570
|
+
p !== o && (e.data.focusedTag = p, e.data.activedescendant = w.TagsList), this.applyState(e);
|
|
558
571
|
}
|
|
559
572
|
triggerOnChange(n, e) {
|
|
560
573
|
this.props.value === void 0 && (e.data.value = [...n]), this._valueItemsDuringOnChange = [], this.setItems(n, this._valueItemsDuringOnChange), e.events.push({ type: "onChange" });
|
|
561
574
|
}
|
|
562
575
|
selectFocusedItem(n, e) {
|
|
563
|
-
const { virtual: t } = this.props,
|
|
564
|
-
|
|
576
|
+
const { virtual: t } = this.props, o = x(this.props), { focusedIndex: s } = e || this.getFocusedState(), a = t ? t.skip : 0;
|
|
577
|
+
o[s - a] !== void 0 && this.handleItemClick(s, n);
|
|
565
578
|
}
|
|
566
579
|
setItems(n, e) {
|
|
567
580
|
e.length = 0, e.push(...n);
|
|
@@ -569,21 +582,21 @@ const { sizeMap: D, roundedMap: ve } = ie, be = "Please enter a valid value!", H
|
|
|
569
582
|
getFocusedState() {
|
|
570
583
|
const { focusedIndex: n } = this.state, e = this.props.filter !== void 0 ? this.props.filter : this.state.text, {
|
|
571
584
|
allowCustom: t,
|
|
572
|
-
dataItemKey:
|
|
585
|
+
dataItemKey: o,
|
|
573
586
|
virtual: s,
|
|
574
|
-
textField:
|
|
575
|
-
focusedItemIndex:
|
|
576
|
-
skipDisabledItems:
|
|
577
|
-
} = this.props, r =
|
|
587
|
+
textField: a,
|
|
588
|
+
focusedItemIndex: i = ce,
|
|
589
|
+
skipDisabledItems: p
|
|
590
|
+
} = this.props, r = x(this.props), d = s && s.skip || 0;
|
|
578
591
|
let l;
|
|
579
592
|
if (n !== void 0)
|
|
580
593
|
return {
|
|
581
594
|
focusedIndex: n,
|
|
582
|
-
focusedItem: r[n -
|
|
595
|
+
focusedItem: r[n - d],
|
|
583
596
|
focusedType: 1
|
|
584
597
|
/* ListItem */
|
|
585
598
|
};
|
|
586
|
-
const
|
|
599
|
+
const h = this.value;
|
|
587
600
|
if (t && e)
|
|
588
601
|
return {
|
|
589
602
|
focusedItem: null,
|
|
@@ -592,30 +605,30 @@ const { sizeMap: D, roundedMap: ve } = ie, be = "Please enter a valid value!", H
|
|
|
592
605
|
/* CustomItem */
|
|
593
606
|
};
|
|
594
607
|
if (e)
|
|
595
|
-
return l =
|
|
608
|
+
return l = i(r, e, a), {
|
|
596
609
|
focusedItem: r[l],
|
|
597
|
-
focusedIndex: l +
|
|
610
|
+
focusedIndex: l + d,
|
|
598
611
|
focusedType: 1
|
|
599
612
|
/* ListItem */
|
|
600
613
|
};
|
|
601
|
-
if (
|
|
602
|
-
const
|
|
603
|
-
return l = r.findIndex((
|
|
604
|
-
focusedIndex: l +
|
|
614
|
+
if (h.length) {
|
|
615
|
+
const f = h[h.length - 1];
|
|
616
|
+
return l = r.findIndex((c) => P(c, f, o)), r[l] !== void 0 ? {
|
|
617
|
+
focusedIndex: l + d,
|
|
605
618
|
focusedItem: r[l],
|
|
606
619
|
focusedType: 1
|
|
607
620
|
/* ListItem */
|
|
608
621
|
} : { focusedType: 0, focusedIndex: -1 };
|
|
609
|
-
} else if (
|
|
610
|
-
const
|
|
622
|
+
} else if (p && a && !e && d === 0) {
|
|
623
|
+
const f = r.findIndex((c) => !c.disabled && c[a]);
|
|
611
624
|
return {
|
|
612
|
-
focusedIndex:
|
|
613
|
-
focusedItem: r[
|
|
625
|
+
focusedIndex: f,
|
|
626
|
+
focusedItem: r[f - d],
|
|
614
627
|
focusedType: 1
|
|
615
628
|
/* ListItem */
|
|
616
629
|
};
|
|
617
630
|
}
|
|
618
|
-
return
|
|
631
|
+
return d === 0 ? {
|
|
619
632
|
focusedItem: r[0],
|
|
620
633
|
focusedIndex: 0,
|
|
621
634
|
focusedType: 1
|
|
@@ -651,33 +664,33 @@ const { sizeMap: D, roundedMap: ve } = ie, be = "Please enter a valid value!", H
|
|
|
651
664
|
return this._lastSelectedOrDeslectedItemIndex === null && (this._lastSelectedOrDeslectedItemIndex = e), this._lastSelectedOrDeslectedItemIndex !== null ? this._lastSelectedOrDeslectedItemIndex + n : null;
|
|
652
665
|
}
|
|
653
666
|
};
|
|
654
|
-
|
|
655
|
-
...
|
|
656
|
-
autoClose:
|
|
657
|
-
value:
|
|
658
|
-
defaultValue:
|
|
659
|
-
dataItemKey:
|
|
660
|
-
placeholder:
|
|
661
|
-
tags:
|
|
662
|
-
|
|
663
|
-
text:
|
|
664
|
-
data:
|
|
667
|
+
C.displayName = "MultiSelect", C.propTypes = {
|
|
668
|
+
...O.propTypes,
|
|
669
|
+
autoClose: v.bool,
|
|
670
|
+
value: v.arrayOf(v.any),
|
|
671
|
+
defaultValue: v.arrayOf(v.any),
|
|
672
|
+
dataItemKey: v.string,
|
|
673
|
+
placeholder: v.string,
|
|
674
|
+
tags: v.arrayOf(
|
|
675
|
+
v.shape({
|
|
676
|
+
text: v.string,
|
|
677
|
+
data: v.arrayOf(v.any)
|
|
665
678
|
})
|
|
666
679
|
),
|
|
667
|
-
tagRender:
|
|
668
|
-
id:
|
|
669
|
-
ariaLabelledBy:
|
|
670
|
-
ariaDescribedBy:
|
|
671
|
-
groupField:
|
|
672
|
-
list:
|
|
673
|
-
adaptive:
|
|
674
|
-
adaptiveTitle:
|
|
675
|
-
adaptiveSubtitle:
|
|
676
|
-
onCancel:
|
|
677
|
-
skipDisabledItems:
|
|
678
|
-
inputAttributes:
|
|
679
|
-
},
|
|
680
|
-
...
|
|
680
|
+
tagRender: v.func,
|
|
681
|
+
id: v.string,
|
|
682
|
+
ariaLabelledBy: v.string,
|
|
683
|
+
ariaDescribedBy: v.string,
|
|
684
|
+
groupField: v.string,
|
|
685
|
+
list: v.any,
|
|
686
|
+
adaptive: v.bool,
|
|
687
|
+
adaptiveTitle: v.string,
|
|
688
|
+
adaptiveSubtitle: v.string,
|
|
689
|
+
onCancel: v.func,
|
|
690
|
+
skipDisabledItems: v.bool,
|
|
691
|
+
inputAttributes: v.object
|
|
692
|
+
}, C.defaultProps = {
|
|
693
|
+
...O.defaultProps,
|
|
681
694
|
autoClose: !0,
|
|
682
695
|
required: !1,
|
|
683
696
|
size: "medium",
|
|
@@ -688,16 +701,16 @@ y.displayName = "MultiSelect", y.propTypes = {
|
|
|
688
701
|
prefix: void 0,
|
|
689
702
|
suffix: void 0
|
|
690
703
|
};
|
|
691
|
-
let
|
|
704
|
+
let N = C;
|
|
692
705
|
const Ie = Z(), ye = ee(
|
|
693
706
|
te(
|
|
694
707
|
Ie,
|
|
695
|
-
se(
|
|
708
|
+
se(N)
|
|
696
709
|
)
|
|
697
710
|
);
|
|
698
711
|
ye.displayName = "KendoReactMultiSelect";
|
|
699
712
|
export {
|
|
700
713
|
ye as MultiSelect,
|
|
701
714
|
Ie as MultiSelectPropsContext,
|
|
702
|
-
|
|
715
|
+
N as MultiSelectWithoutContext
|
|
703
716
|
};
|