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