@progress/kendo-react-dropdowns 9.2.0-develop.4 → 9.2.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/AutoComplete/AutoComplete.js +1 -1
- package/AutoComplete/AutoComplete.mjs +21 -20
- package/ComboBox/ComboBox.js +1 -1
- package/ComboBox/ComboBox.mjs +145 -140
- package/DropDownList/DropDownList.js +1 -1
- package/DropDownList/DropDownList.mjs +335 -332
- package/DropDownTree/DropDownTree.js +1 -1
- package/DropDownTree/DropDownTree.mjs +192 -192
- package/MultiSelect/MultiSelect.js +1 -1
- package/MultiSelect/MultiSelect.mjs +147 -146
- package/MultiSelectTree/MultiSelectTree.js +1 -1
- package/MultiSelectTree/MultiSelectTree.mjs +143 -143
- package/common/AdaptiveMode.js +1 -1
- package/common/AdaptiveMode.mjs +17 -17
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/index.d.mts +18 -9
- package/index.d.ts +18 -9
- package/package-metadata.mjs +1 -1
- package/package.json +9 -9
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
import * as f from "react";
|
|
10
10
|
import m from "prop-types";
|
|
11
|
-
import { Keys as u, classNames as b, IconWrap as R, validatePackage as X, canUseDOM as L,
|
|
11
|
+
import { Keys as u, classNames as b, IconWrap as R, validatePackage as X, canUseDOM as L, createPropsContext as Z, withIdHOC as tt, withPropsContext as et, withAdaptiveModeContext as st, kendoThemeMaps as it } from "@progress/kendo-react-common";
|
|
12
12
|
import { plusIcon as ot } from "@progress/kendo-svg-icons";
|
|
13
13
|
import { FloatingLabel as at } from "@progress/kendo-react-labels";
|
|
14
14
|
import nt from "../common/ListContainer.mjs";
|
|
@@ -18,7 +18,7 @@ import rt from "./TagList.mjs";
|
|
|
18
18
|
import ht from "../common/SearchBar.mjs";
|
|
19
19
|
import F from "../common/DropDownBase.mjs";
|
|
20
20
|
import { ActiveDescendant as k } from "../common/settings.mjs";
|
|
21
|
-
import { getFilteredData as I, areSame as
|
|
21
|
+
import { getFilteredData as I, areSame as M, removeDataItems as w, isPresent as E, getItemValue as O, preventDefaultNonInputs as pt, matchTags as B, itemIndexStartsWith as ct } from "../common/utils.mjs";
|
|
22
22
|
import { packageMetadata as ut } from "../package-metadata.mjs";
|
|
23
23
|
import ft from "../common/ClearButton.mjs";
|
|
24
24
|
import { AdaptiveMode as gt } from "../common/AdaptiveMode.mjs";
|
|
@@ -34,82 +34,82 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
34
34
|
currentValue: []
|
|
35
35
|
}, this._element = null, this._valueItemsDuringOnChange = null, this.base = new F(this), this._tags = [], this._input = null, this._adaptiveInput = null, this._skipFocusEvent = !1, this._lastSelectedOrDeslectedItemIndex = null, this.itemHeight = 0, this.scrollToFocused = !1, this.localization = null, this.focus = () => {
|
|
36
36
|
this._input && this._input.focus();
|
|
37
|
-
}, this.handleItemSelect = (
|
|
38
|
-
const { dataItemKey: o, virtual: s } = this.props, a = I(this.props), p = s ? s.skip : 0, c = a[
|
|
39
|
-
this._lastSelectedOrDeslectedItemIndex = a.findIndex((g) =>
|
|
37
|
+
}, this.handleItemSelect = (t, e) => {
|
|
38
|
+
const { dataItemKey: o, virtual: s } = this.props, a = I(this.props), p = s ? s.skip : 0, c = a[t - p], r = this.value.findIndex((g) => M(g, c, o));
|
|
39
|
+
this._lastSelectedOrDeslectedItemIndex = a.findIndex((g) => M(g, c, o));
|
|
40
40
|
let i = [];
|
|
41
|
-
r !== -1 ? (i = this.value, i.splice(r, 1)) : i = [...this.value, c], (this.props.filter !== void 0 ? this.props.filter : this.state.text) && !this.mobileMode && (this.state.text && (
|
|
42
|
-
}, this.onTagDelete = (
|
|
41
|
+
r !== -1 ? (i = this.value, i.splice(r, 1)) : i = [...this.value, c], (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(i, e), this.base.triggerPageChangeCornerItems(c, e);
|
|
42
|
+
}, this.onTagDelete = (t, e) => {
|
|
43
43
|
const o = this.base.initState();
|
|
44
|
-
o.syntheticEvent =
|
|
44
|
+
o.syntheticEvent = e, this.opened && this.base.togglePopup(o), !this.state.focused && !this.mobileMode && (o.data.focused = !0, this.focus());
|
|
45
45
|
const s = this.value;
|
|
46
|
-
w(s,
|
|
47
|
-
}, this.itemFocus = (
|
|
48
|
-
const { allowCustom: o, virtual: s } = this.props, a = I(this.props), p = s ? s.skip : 0, c = this.props.filter !== void 0 ? this.props.filter : this.state.text, { focusedIndex: r } = this.getFocusedState(), i = o && c, l = a[
|
|
49
|
-
l && r !==
|
|
50
|
-
}, this.componentRef = (
|
|
51
|
-
this._element =
|
|
52
|
-
}, this.searchbarRef = (
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
}, this.onChangeHandler = (
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
}, this.clearButtonClick = (
|
|
59
|
-
const
|
|
60
|
-
|
|
46
|
+
w(s, t, this.props.dataItemKey), this.triggerOnChange(s, o), this.applyState(o);
|
|
47
|
+
}, this.itemFocus = (t, e) => {
|
|
48
|
+
const { allowCustom: o, virtual: s } = this.props, a = I(this.props), p = s ? s.skip : 0, c = this.props.filter !== void 0 ? this.props.filter : this.state.text, { focusedIndex: r } = this.getFocusedState(), i = o && c, l = a[t - p];
|
|
49
|
+
l && r !== t ? this.state.focusedIndex !== t && (e.data.focusedIndex = t, e.data.activedescendant = k.PopupList) : i && t === -1 && this.state.focusedIndex !== void 0 && (e.data.focusedIndex = void 0), this.base.triggerPageChangeCornerItems(l, e);
|
|
50
|
+
}, this.componentRef = (t) => {
|
|
51
|
+
this._element = t, this.base.wrapper = t;
|
|
52
|
+
}, this.searchbarRef = (t) => {
|
|
53
|
+
const e = this._input = t && t.input;
|
|
54
|
+
e && this.state.focused && window.setTimeout(() => e.focus(), 0);
|
|
55
|
+
}, this.onChangeHandler = (t) => {
|
|
56
|
+
const e = this.base.initState(), o = t.target.value;
|
|
57
|
+
e.syntheticEvent = t, this.props.filter === void 0 && (e.data.text = o), e.data.focusedIndex = void 0, this.opened || (this.base.togglePopup(e), this.setState({ currentValue: this.value })), this.base.filterChanged(o, e), this.applyState(e), this.setState({ group: void 0 });
|
|
58
|
+
}, this.clearButtonClick = (t) => {
|
|
59
|
+
const e = this.base.initState();
|
|
60
|
+
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);
|
|
61
61
|
const o = this.props.filter !== void 0 ? this.props.filter : this.state.text;
|
|
62
|
-
|
|
63
|
-
}, this.onInputKeyDown = (
|
|
64
|
-
const { textField:
|
|
65
|
-
if (l.syntheticEvent =
|
|
66
|
-
return this.onTagsNavigate(
|
|
62
|
+
E(o) && o !== "" && this.base.filterChanged("", e), this.state.text && (e.data.text = ""), this._lastSelectedOrDeslectedItemIndex = null, this.applyState(e);
|
|
63
|
+
}, this.onInputKeyDown = (t) => {
|
|
64
|
+
const { textField: e, groupField: o } = this.props, s = I(this.props), a = t.keyCode, p = this.props.filter !== void 0 ? this.props.filter : this.state.text, c = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { focusedItem: r, focusedIndex: i } = this.getFocusedState(), l = this.base.initState();
|
|
65
|
+
if (l.syntheticEvent = t, !p && this.value.length > 0 && (a === u.left || a === u.right || a === u.home || a === u.end || a === u.delete || a === u.backspace) && !t.shiftKey)
|
|
66
|
+
return this.onTagsNavigate(t, l);
|
|
67
67
|
const g = () => {
|
|
68
|
-
|
|
68
|
+
t.preventDefault(), this.base.togglePopup(l), this.applyState(l);
|
|
69
69
|
};
|
|
70
70
|
if (this.opened)
|
|
71
71
|
if (a === u.pageUp)
|
|
72
|
-
|
|
72
|
+
t.preventDefault(), this.base.scrollPopupByPageSize(-1);
|
|
73
73
|
else if (a === u.pageDown)
|
|
74
|
-
|
|
75
|
-
else if ((
|
|
74
|
+
t.preventDefault(), this.base.scrollPopupByPageSize(1);
|
|
75
|
+
else if ((t.ctrlKey || t.metaKey) && t.code === "KeyA") {
|
|
76
76
|
const h = (this.state.value && this.state.value.length) === s.length ? [] : s;
|
|
77
77
|
this.updateStateOnKeyboardNavigation(h, l);
|
|
78
|
-
} else if ((
|
|
78
|
+
} else if ((t.ctrlKey || t.metaKey) && t.shiftKey && t.keyCode === u.end) {
|
|
79
79
|
const d = s.slice(this.getFocusedState().focusedIndex);
|
|
80
80
|
this.itemFocus(s.length - 1, l), this.updateStateOnKeyboardNavigation(d, l);
|
|
81
|
-
} else if ((
|
|
81
|
+
} else if ((t.ctrlKey || t.metaKey) && t.shiftKey && t.keyCode === u.home) {
|
|
82
82
|
const d = s.slice(0, this.getFocusedState().focusedIndex + 1);
|
|
83
83
|
this.itemFocus(0, l), this.updateStateOnKeyboardNavigation(d, l);
|
|
84
|
-
} else if (
|
|
84
|
+
} else if (t.shiftKey && t.keyCode === u.up) {
|
|
85
85
|
let d;
|
|
86
86
|
const h = this.getLastSelectedOrDeselectedIndex(1, i);
|
|
87
87
|
h === null ? d = i !== 0 ? s.slice(i - 1, i) : [s[i]] : h === i ? d = [s[h - 1]] : i >= 0 && (d = h > i ? s.slice(i - 1, h) : s.slice(h - 1, i)), d && d.length > 0 && (i >= 1 && this.itemFocus(i - 1, l), this.updateStateOnKeyboardNavigation(d, l));
|
|
88
|
-
} else if (
|
|
88
|
+
} else if (t.shiftKey && t.keyCode === u.down) {
|
|
89
89
|
let d;
|
|
90
90
|
const h = this.getLastSelectedOrDeselectedIndex(0, i);
|
|
91
91
|
h === null ? d = i !== s.length - 1 ? s.slice(i, i + 1) : [s[i]] : h === i ? d = s.slice(i, i + 2) : i >= 0 && (d = h > i ? s.slice(i + 1, h + 1) : s.slice(h, i + 2)), d && d.length >= 1 && (this.itemFocus(i + 1, l), this.updateStateOnKeyboardNavigation(d, l));
|
|
92
|
-
} else if (
|
|
92
|
+
} else if (t.altKey && a === u.up)
|
|
93
93
|
g();
|
|
94
94
|
else if (a === u.up || a === u.down) {
|
|
95
|
-
if (o !== "" &&
|
|
95
|
+
if (o !== "" && e)
|
|
96
96
|
if (!this.props.skipDisabledItems && c)
|
|
97
97
|
this.onNavigate(l, a);
|
|
98
98
|
else {
|
|
99
99
|
let d = 0;
|
|
100
100
|
if (a === u.down || a === u.right) {
|
|
101
|
-
const h = s.slice(i + 1).find((v) => !v.disabled && v[
|
|
102
|
-
d = h && s.findIndex((v) => v[
|
|
101
|
+
const h = s.slice(i + 1).find((v) => !v.disabled && v[e]);
|
|
102
|
+
d = h && s.findIndex((v) => v[e] === h[e]);
|
|
103
103
|
} else if (a === u.up || a === u.left) {
|
|
104
104
|
let h;
|
|
105
105
|
if (i === -1)
|
|
106
|
-
h = s, d = s.findIndex((v) => !v.disabled && v[
|
|
106
|
+
h = s, d = s.findIndex((v) => !v.disabled && v[e]);
|
|
107
107
|
else {
|
|
108
108
|
h = s.slice(0, i);
|
|
109
109
|
let v = h.pop();
|
|
110
110
|
for (; v && v.disabled; )
|
|
111
111
|
v = h.pop();
|
|
112
|
-
d = v && s.findIndex((x) => x[
|
|
112
|
+
d = v && s.findIndex((x) => x[e] === v[e]);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
if (d) {
|
|
@@ -135,13 +135,13 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
135
135
|
} else
|
|
136
136
|
this.onNavigate(l, a);
|
|
137
137
|
}
|
|
138
|
-
this.applyState(l),
|
|
138
|
+
this.applyState(l), t.preventDefault();
|
|
139
139
|
} else
|
|
140
|
-
a === u.enter ? (
|
|
140
|
+
a === u.enter ? (t.preventDefault(), this.props.allowCustom && p && r === null ? this.customItemSelect(t) : r && r.disabled ? g() : this.selectFocusedItem(t)) : a === u.esc && g();
|
|
141
141
|
else
|
|
142
|
-
|
|
142
|
+
t.altKey && a === u.down ? g() : a === u.esc && this.clearButtonClick(t);
|
|
143
143
|
}, this.listContainerContent = () => {
|
|
144
|
-
const { header:
|
|
144
|
+
const { header: t, footer: e, allowCustom: o, size: s, groupStickyHeaderItemRender: a, groupField: p, list: c } = this.props, r = I(this.props), i = this.props.filter !== void 0 ? this.props.filter : this.state.text, { focusedType: l } = this.getFocusedState(), g = o && i && /* @__PURE__ */ f.createElement(
|
|
145
145
|
"div",
|
|
146
146
|
{
|
|
147
147
|
className: b("k-list", {
|
|
@@ -162,7 +162,7 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
162
162
|
)
|
|
163
163
|
);
|
|
164
164
|
let { group: d } = this.state;
|
|
165
|
-
return d === void 0 && p !== void 0 && (d = O(r[0], p)), /* @__PURE__ */ f.createElement(f.Fragment, null,
|
|
165
|
+
return d === void 0 && p !== void 0 && (d = O(r[0], p)), /* @__PURE__ */ f.createElement(f.Fragment, null, t && /* @__PURE__ */ f.createElement("div", { className: "k-list-header" }, t), g, /* @__PURE__ */ f.createElement(
|
|
166
166
|
"div",
|
|
167
167
|
{
|
|
168
168
|
className: b("k-list", {
|
|
@@ -172,10 +172,10 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
172
172
|
},
|
|
173
173
|
!c && d && r.length !== 0 && /* @__PURE__ */ f.createElement(dt, { group: d, groupMode: "modern", render: a }),
|
|
174
174
|
this.renderList()
|
|
175
|
-
),
|
|
175
|
+
), e && /* @__PURE__ */ f.createElement("div", { className: "k-list-footer" }, e));
|
|
176
176
|
}, this.renderListContainer = () => {
|
|
177
|
-
const
|
|
178
|
-
dir:
|
|
177
|
+
const t = this.base, { dir: e } = this.props, o = I(this.props), s = this.base.getPopupSettings(), a = s.width !== void 0 ? s.width : t.popupWidth, p = {
|
|
178
|
+
dir: e !== void 0 ? e : t.dirCalculated,
|
|
179
179
|
width: a,
|
|
180
180
|
popupSettings: {
|
|
181
181
|
...s,
|
|
@@ -189,9 +189,9 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
189
189
|
};
|
|
190
190
|
return /* @__PURE__ */ f.createElement(nt, { ...p }, this.listContainerContent());
|
|
191
191
|
}, this.renderAdaptiveListContainer = () => {
|
|
192
|
-
const { adaptiveTitle:
|
|
192
|
+
const { adaptiveTitle: t, filterable: e, filter: o } = this.props, { windowWidth: s = 0 } = this.state, a = o !== void 0 ? o : this.state.text;
|
|
193
193
|
this.localization = vt(this);
|
|
194
|
-
const p =
|
|
194
|
+
const p = e ? /* @__PURE__ */ f.createElement(
|
|
195
195
|
It,
|
|
196
196
|
{
|
|
197
197
|
value: a,
|
|
@@ -203,7 +203,7 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
203
203
|
fillMode: this.props.fillMode
|
|
204
204
|
}
|
|
205
205
|
) : null, c = {
|
|
206
|
-
title:
|
|
206
|
+
title: t,
|
|
207
207
|
expand: this.opened,
|
|
208
208
|
onClose: (r) => this.onCancel(r),
|
|
209
209
|
windowWidth: s,
|
|
@@ -222,20 +222,20 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
224
|
return /* @__PURE__ */ f.createElement(gt, { ...c }, /* @__PURE__ */ f.createElement(mt, { overflowHidden: !0 }, /* @__PURE__ */ f.createElement("div", { className: "k-list-container" }, this.listContainerContent())));
|
|
225
|
-
}, this.closePopup = (
|
|
226
|
-
const
|
|
227
|
-
|
|
225
|
+
}, this.closePopup = (t) => {
|
|
226
|
+
const e = this.base.initState();
|
|
227
|
+
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" });
|
|
228
228
|
const o = this.props.filter !== void 0 ? this.props.filter : this.state.text;
|
|
229
|
-
|
|
230
|
-
}, this.onCancel = (
|
|
231
|
-
const
|
|
232
|
-
|
|
229
|
+
E(o) && o !== "" && this.base.filterChanged("", e), this.state.text && (e.data.text = ""), this.applyState(e);
|
|
230
|
+
}, this.onCancel = (t) => {
|
|
231
|
+
const e = this.base.initState();
|
|
232
|
+
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" });
|
|
233
233
|
const o = this.props.filter !== void 0 ? this.props.filter : this.state.text;
|
|
234
|
-
|
|
234
|
+
E(o) && o !== "" && this.base.filterChanged("", e), this.state.text && (e.data.text = ""), this.applyState(e);
|
|
235
235
|
}, this.renderList = () => {
|
|
236
236
|
const {
|
|
237
|
-
textField:
|
|
238
|
-
listNoDataRender:
|
|
237
|
+
textField: t,
|
|
238
|
+
listNoDataRender: e,
|
|
239
239
|
itemRender: o,
|
|
240
240
|
groupHeaderItemRender: s,
|
|
241
241
|
dataItemKey: a,
|
|
@@ -249,7 +249,7 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
249
249
|
data: c.slice(),
|
|
250
250
|
focusedIndex: i - p.skip,
|
|
251
251
|
value: this.value,
|
|
252
|
-
textField:
|
|
252
|
+
textField: t,
|
|
253
253
|
valueField: a,
|
|
254
254
|
optionsGuid: this.base.guid,
|
|
255
255
|
groupField: this.props.groupField,
|
|
@@ -265,7 +265,7 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
265
265
|
onClick: this.handleItemClick,
|
|
266
266
|
itemRender: o,
|
|
267
267
|
groupHeaderItemRender: s,
|
|
268
|
-
noDataRender:
|
|
268
|
+
noDataRender: e,
|
|
269
269
|
onMouseDown: $,
|
|
270
270
|
onBlur: this.handleBlur,
|
|
271
271
|
onScroll: this.onScroll,
|
|
@@ -274,13 +274,13 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
274
274
|
ariaSetSize: p.total
|
|
275
275
|
}
|
|
276
276
|
);
|
|
277
|
-
}, this.onScroll = (
|
|
278
|
-
const { vs:
|
|
279
|
-
|
|
277
|
+
}, this.onScroll = (t) => {
|
|
278
|
+
const { vs: e, list: o } = this.base;
|
|
279
|
+
e.scrollHandler(t);
|
|
280
280
|
const { groupField: s } = this.props;
|
|
281
281
|
let a = I(this.props);
|
|
282
282
|
if (!(!s || !a.length) && s) {
|
|
283
|
-
const p = this.itemHeight = this.itemHeight || (
|
|
283
|
+
const p = this.itemHeight = this.itemHeight || (e.enabled ? e.itemHeight : o ? o.children[0].offsetHeight : 0), r = t.target.scrollTop - e.skip * p;
|
|
284
284
|
a = this.base.getGroupedDataModernMode(a, s);
|
|
285
285
|
let i = a[0][s];
|
|
286
286
|
for (let l = 1; l < a.length && !(p * l > r); l++)
|
|
@@ -289,31 +289,31 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
289
289
|
group: i
|
|
290
290
|
});
|
|
291
291
|
}
|
|
292
|
-
}, this.customItemSelect = (
|
|
293
|
-
const
|
|
294
|
-
if (!
|
|
292
|
+
}, this.customItemSelect = (t) => {
|
|
293
|
+
const e = this.props.filter !== void 0 ? this.props.filter : this.state.text, { textField: o } = this.props;
|
|
294
|
+
if (!e)
|
|
295
295
|
return;
|
|
296
296
|
const s = this.base.initState();
|
|
297
|
-
s.syntheticEvent =
|
|
298
|
-
const a = o ? { [o]:
|
|
297
|
+
s.syntheticEvent = t;
|
|
298
|
+
const a = o ? { [o]: e } : e;
|
|
299
299
|
this.state.text !== void 0 && (s.data.text = ""), s.data.focusedIndex = void 0, this.base.filterChanged("", s);
|
|
300
300
|
const p = [...this.value, a];
|
|
301
301
|
this.triggerOnChange(p, s), this.base.togglePopup(s), this.applyState(s);
|
|
302
|
-
}, this.handleWrapperClick = (
|
|
303
|
-
const
|
|
304
|
-
!this.opened &&
|
|
302
|
+
}, this.handleWrapperClick = (t) => {
|
|
303
|
+
const e = this._input;
|
|
304
|
+
!this.opened && e && this.focusElement(e);
|
|
305
305
|
const o = this.base.initState();
|
|
306
|
-
o.syntheticEvent =
|
|
307
|
-
}, this.handleItemClick = (
|
|
306
|
+
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);
|
|
307
|
+
}, this.handleItemClick = (t, e) => {
|
|
308
308
|
const o = this.base.initState();
|
|
309
|
-
o.syntheticEvent =
|
|
310
|
-
}, this.handleBlur = (
|
|
309
|
+
o.syntheticEvent = e, this.handleItemSelect(t, o), this.props.autoClose && !this.mobileMode && this.base.togglePopup(o), e.stopPropagation(), this.applyState(o);
|
|
310
|
+
}, this.handleBlur = (t) => {
|
|
311
311
|
if (!this.state.focused || this._skipFocusEvent)
|
|
312
312
|
return;
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
}, this.handleFocus = (
|
|
316
|
-
this._skipFocusEvent || this.base.handleFocus(
|
|
313
|
+
const e = this.base.initState(), { allowCustom: o, filterable: s } = this.props;
|
|
314
|
+
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);
|
|
315
|
+
}, this.handleFocus = (t) => {
|
|
316
|
+
this._skipFocusEvent || this.base.handleFocus(t);
|
|
317
317
|
}, this.onPopupOpened = () => {
|
|
318
318
|
this._input && this.state.focused && !this.mobileMode && this.focusElement(this._input);
|
|
319
319
|
}, this.onPopupClosed = () => {
|
|
@@ -343,16 +343,17 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
343
343
|
}
|
|
344
344
|
/** @hidden */
|
|
345
345
|
get tagsToRender() {
|
|
346
|
-
const { tags: n, textField:
|
|
346
|
+
const { tags: n, textField: t } = this.props, e = [];
|
|
347
347
|
return n === void 0 ? this.value.forEach((o) => {
|
|
348
|
-
|
|
349
|
-
}) :
|
|
348
|
+
e.push({ text: O(o, t), data: [o] });
|
|
349
|
+
}) : e.push(...n), e;
|
|
350
350
|
}
|
|
351
351
|
/**
|
|
352
352
|
* The mobile mode of the MultiSelect.
|
|
353
353
|
*/
|
|
354
354
|
get mobileMode() {
|
|
355
|
-
|
|
355
|
+
var t;
|
|
356
|
+
return !!(this.state.windowWidth && this.props._adaptiveMode && this.state.windowWidth <= ((t = this.props._adaptiveMode) == null ? void 0 : t.medium) && this.props.adaptive);
|
|
356
357
|
}
|
|
357
358
|
/**
|
|
358
359
|
* Represents the value of the MultiSelect.
|
|
@@ -371,10 +372,10 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
371
372
|
* Represents the validity state into which the MultiSelect is set.
|
|
372
373
|
*/
|
|
373
374
|
get validity() {
|
|
374
|
-
const n = this.props.validationMessage !== void 0,
|
|
375
|
+
const n = 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;
|
|
375
376
|
return {
|
|
376
377
|
customError: n,
|
|
377
|
-
valid:
|
|
378
|
+
valid: e,
|
|
378
379
|
valueMissing: this.value === null
|
|
379
380
|
};
|
|
380
381
|
}
|
|
@@ -386,14 +387,14 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
386
387
|
return this.props.validityStyles !== void 0 ? this.props.validityStyles : y.defaultProps.validityStyles;
|
|
387
388
|
}
|
|
388
389
|
/** @hidden */
|
|
389
|
-
componentDidUpdate(n,
|
|
390
|
+
componentDidUpdate(n, t) {
|
|
390
391
|
var g;
|
|
391
|
-
const { virtual:
|
|
392
|
-
if (this.base.didUpdate(), !l.animate && i && this.onPopupClosed(),
|
|
392
|
+
const { virtual: e, groupField: o = "" } = this.props, s = I(this.props), a = e ? e.skip : 0, p = n.virtual ? n.virtual.total : 0, c = n.opened !== void 0 ? n.opened : t.opened, r = !c && this.opened, i = c && !this.opened, l = this.base.getPopupSettings();
|
|
393
|
+
if (this.base.didUpdate(), !l.animate && i && this.onPopupClosed(), e && e.total !== p)
|
|
393
394
|
this.base.vs.calcScrollElementHeight(), this.base.vs.reset();
|
|
394
395
|
else {
|
|
395
396
|
let { focusedItem: d, focusedIndex: h } = this.getFocusedState();
|
|
396
|
-
o !== "" && (h = (g = this.base.getGroupedDataModernMode(s, o)) == null ? void 0 : g.indexOf(d)), r &&
|
|
397
|
+
o !== "" && (h = (g = this.base.getGroupedDataModernMode(s, o)) == null ? void 0 : g.indexOf(d)), r && e ? this.base.scrollToVirtualItem(e, h - a) : r && !e ? (s && s.length !== 0 && this.base.resetGroupStickyHeader(s[0][o], this), this.base.scrollToItem(h)) : this.opened && c && d && this.scrollToFocused && this.base.scrollToItem(h - a);
|
|
397
398
|
}
|
|
398
399
|
this.scrollToFocused = !1, this.setValidity();
|
|
399
400
|
}
|
|
@@ -408,17 +409,17 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
408
409
|
(n = this.document) != null && n.body && this.observerResize && this.observerResize.disconnect();
|
|
409
410
|
}
|
|
410
411
|
/** @hidden */
|
|
411
|
-
onNavigate(n,
|
|
412
|
+
onNavigate(n, t, e) {
|
|
412
413
|
const { allowCustom: o } = this.props, s = I(this.props), a = this.props.filter !== void 0 ? this.props.filter : this.state.text, { focusedType: p, focusedIndex: c } = this.getFocusedState(), r = o && a, i = q(p), l = this.base, g = l.vs;
|
|
413
|
-
if (this.opened &&
|
|
414
|
+
if (this.opened && t === u.up && i)
|
|
414
415
|
this.state.focusedIndex !== void 0 && (n.data.focusedIndex = void 0);
|
|
415
416
|
else {
|
|
416
417
|
const d = l.navigation.navigate({
|
|
417
|
-
keyCode:
|
|
418
|
+
keyCode: t,
|
|
418
419
|
current: c,
|
|
419
420
|
max: (g.enabled ? g.total : s.length) - 1,
|
|
420
421
|
min: r ? -1 : 0,
|
|
421
|
-
skipItems:
|
|
422
|
+
skipItems: e || void 0
|
|
422
423
|
});
|
|
423
424
|
d !== void 0 && (this.itemFocus(d, n), this.scrollToFocused = !0);
|
|
424
425
|
}
|
|
@@ -428,8 +429,8 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
428
429
|
render() {
|
|
429
430
|
const {
|
|
430
431
|
style: n,
|
|
431
|
-
className:
|
|
432
|
-
label:
|
|
432
|
+
className: t,
|
|
433
|
+
label: e,
|
|
433
434
|
dir: o,
|
|
434
435
|
disabled: s,
|
|
435
436
|
textField: a,
|
|
@@ -440,25 +441,25 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
440
441
|
fillMode: l,
|
|
441
442
|
loading: g,
|
|
442
443
|
filter: d
|
|
443
|
-
} = this.props, { text: h, focused: v, focusedTag: x, currentValue: W } = this.state, C = this.base.vs,
|
|
444
|
+
} = this.props, { text: h, focused: v, focusedTag: x, currentValue: W } = this.state, C = this.base.vs, _ = this.props.id || this._inputId;
|
|
444
445
|
C.enabled = c !== void 0, c !== void 0 && (C.skip = c.skip, C.total = c.total, C.pageSize = c.pageSize);
|
|
445
446
|
const S = this.mobileMode && this.opened ? W : this.tagsToRender;
|
|
446
447
|
this.setItems(this.tagsToRender, this._tags);
|
|
447
|
-
const
|
|
448
|
+
const K = !this.validityStyles || this.validity.valid, G = !!(d !== void 0 ? d : h) || S && S.length > 0, [U, j] = H(this.props.prefix || f.Fragment), [Y, J] = H(this.props.suffix || f.Fragment), N = /* @__PURE__ */ f.createElement(f.Fragment, null, /* @__PURE__ */ f.createElement(
|
|
448
449
|
"div",
|
|
449
450
|
{
|
|
450
451
|
ref: this.componentRef,
|
|
451
|
-
className: b("k-multiselect k-input",
|
|
452
|
+
className: b("k-multiselect k-input", t, {
|
|
452
453
|
[`k-input-${T[r] || r}`]: r,
|
|
453
454
|
[`k-rounded-${bt[i] || i}`]: i,
|
|
454
455
|
[`k-input-${l}`]: l,
|
|
455
456
|
"k-focus": v && !s,
|
|
456
|
-
"k-invalid": !
|
|
457
|
+
"k-invalid": !K,
|
|
457
458
|
"k-disabled": s,
|
|
458
459
|
"k-loading": g,
|
|
459
460
|
"k-required": this.required
|
|
460
461
|
}),
|
|
461
|
-
style:
|
|
462
|
+
style: e ? { ...n, width: void 0 } : n,
|
|
462
463
|
dir: o,
|
|
463
464
|
onFocus: this.handleFocus,
|
|
464
465
|
onBlur: this.handleBlur,
|
|
@@ -484,19 +485,19 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
484
485
|
size: r
|
|
485
486
|
}
|
|
486
487
|
)
|
|
487
|
-
), this.renderSearchBar(
|
|
488
|
+
), this.renderSearchBar(_)),
|
|
488
489
|
g && /* @__PURE__ */ f.createElement(R, { className: "k-input-loading-icon", name: "loading" }),
|
|
489
490
|
this.props.suffix && /* @__PURE__ */ f.createElement(Y, { ...J }),
|
|
490
491
|
G && /* @__PURE__ */ f.createElement(ft, { onClick: this.clearButtonClick }),
|
|
491
492
|
!this.mobileMode && this.renderListContainer()
|
|
492
493
|
), this.mobileMode && this.renderAdaptiveListContainer());
|
|
493
|
-
return
|
|
494
|
+
return e ? /* @__PURE__ */ f.createElement(
|
|
494
495
|
at,
|
|
495
496
|
{
|
|
496
|
-
label:
|
|
497
|
-
editorId:
|
|
497
|
+
label: e,
|
|
498
|
+
editorId: _,
|
|
498
499
|
editorValue: h || O(this.value[0], a),
|
|
499
|
-
editorValid:
|
|
500
|
+
editorValid: K,
|
|
500
501
|
editorDisabled: s,
|
|
501
502
|
style: { width: n ? n.width : void 0 },
|
|
502
503
|
children: N
|
|
@@ -504,7 +505,7 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
504
505
|
) : N;
|
|
505
506
|
}
|
|
506
507
|
renderSearchBar(n) {
|
|
507
|
-
const { activedescendant:
|
|
508
|
+
const { activedescendant: t, focusedTag: e, currentValue: o } = this.state, { disabled: s, placeholder: a, ariaDescribedBy: p, ariaLabelledBy: c, ariaLabel: r, inputAttributes: i } = this.props, l = !this.mobileMode && (this.props.filter !== void 0 ? this.props.filter : this.state.text) || "", { focusedIndex: g } = this.getFocusedState(), d = this.value.length === 0 && !l ? a : void 0, h = o && o.length > 0 ? void 0 : a, v = t === k.TagsList && e !== void 0 ? `tag-${this.base.guid}-${e.text.replace(/\s+/g, "-")}` : `option-${this.base.guid}-${g}`, x = {
|
|
508
509
|
accessKey: this.props.accessKey,
|
|
509
510
|
tabIndex: this.props.tabIndex
|
|
510
511
|
};
|
|
@@ -532,47 +533,47 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
532
533
|
}
|
|
533
534
|
);
|
|
534
535
|
}
|
|
535
|
-
onTagsNavigate(n,
|
|
536
|
-
const
|
|
536
|
+
onTagsNavigate(n, t) {
|
|
537
|
+
const e = n.keyCode, { focusedTag: o } = this.state, s = this._tags, a = this.props.dataItemKey;
|
|
537
538
|
let p = o ? s.findIndex((i) => B(i, o, a)) : -1, c;
|
|
538
539
|
const r = p !== -1;
|
|
539
|
-
if (
|
|
540
|
+
if (e === u.left)
|
|
540
541
|
r ? p = Math.max(0, p - 1) : p = s.length - 1, c = s[p];
|
|
541
|
-
else if (
|
|
542
|
+
else if (e === u.right)
|
|
542
543
|
p === s.length - 1 ? c = void 0 : r && (p = Math.min(s.length - 1, p + 1), c = s[p]);
|
|
543
|
-
else if (
|
|
544
|
+
else if (e === u.home && !n.shiftKey)
|
|
544
545
|
c = s[0];
|
|
545
|
-
else if (
|
|
546
|
+
else if (e === u.end && !n.shiftKey)
|
|
546
547
|
c = s[s.length - 1];
|
|
547
|
-
else if (
|
|
548
|
+
else if (e === u.delete) {
|
|
548
549
|
if (r) {
|
|
549
550
|
const i = this.value;
|
|
550
|
-
w(i, s[p].data, a), this.triggerOnChange(i,
|
|
551
|
+
w(i, s[p].data, a), this.triggerOnChange(i, t);
|
|
551
552
|
}
|
|
552
|
-
} else if (
|
|
553
|
+
} else if (e === u.backspace) {
|
|
553
554
|
const i = this.value;
|
|
554
555
|
if (r)
|
|
555
|
-
w(i, s[p].data, a), this.triggerOnChange(i,
|
|
556
|
+
w(i, s[p].data, a), this.triggerOnChange(i, t);
|
|
556
557
|
else if (!r && s.length) {
|
|
557
558
|
const l = s.pop();
|
|
558
|
-
w(i, l.data, a), this.triggerOnChange(i,
|
|
559
|
+
w(i, l.data, a), this.triggerOnChange(i, t);
|
|
559
560
|
}
|
|
560
561
|
}
|
|
561
|
-
c !== o && (
|
|
562
|
+
c !== o && (t.data.focusedTag = c, t.data.activedescendant = k.TagsList), this.applyState(t);
|
|
562
563
|
}
|
|
563
|
-
triggerOnChange(n,
|
|
564
|
-
this.props.value === void 0 && (
|
|
564
|
+
triggerOnChange(n, t) {
|
|
565
|
+
this.props.value === void 0 && (t.data.value = [...n]), this._valueItemsDuringOnChange = [], this.setItems(n, this._valueItemsDuringOnChange), t.events.push({ type: "onChange" });
|
|
565
566
|
}
|
|
566
|
-
selectFocusedItem(n,
|
|
567
|
-
const { virtual:
|
|
567
|
+
selectFocusedItem(n, t) {
|
|
568
|
+
const { virtual: e } = this.props, o = I(this.props), { focusedIndex: s } = t || this.getFocusedState(), a = e ? e.skip : 0;
|
|
568
569
|
o[s - a] !== void 0 && this.handleItemClick(s, n);
|
|
569
570
|
}
|
|
570
|
-
setItems(n,
|
|
571
|
-
|
|
571
|
+
setItems(n, t) {
|
|
572
|
+
t.length = 0, t.push(...n);
|
|
572
573
|
}
|
|
573
574
|
getFocusedState() {
|
|
574
|
-
const { focusedIndex: n } = this.state,
|
|
575
|
-
allowCustom:
|
|
575
|
+
const { focusedIndex: n } = this.state, t = this.props.filter !== void 0 ? this.props.filter : this.state.text, {
|
|
576
|
+
allowCustom: e,
|
|
576
577
|
dataItemKey: o,
|
|
577
578
|
virtual: s,
|
|
578
579
|
textField: a,
|
|
@@ -588,15 +589,15 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
588
589
|
/* ListItem */
|
|
589
590
|
};
|
|
590
591
|
const g = this.value;
|
|
591
|
-
if (
|
|
592
|
+
if (e && t)
|
|
592
593
|
return {
|
|
593
594
|
focusedItem: null,
|
|
594
595
|
focusedIndex: -1,
|
|
595
596
|
focusedType: 2
|
|
596
597
|
/* CustomItem */
|
|
597
598
|
};
|
|
598
|
-
if (
|
|
599
|
-
return l = p(r,
|
|
599
|
+
if (t)
|
|
600
|
+
return l = p(r, t, a), {
|
|
600
601
|
focusedItem: r[l],
|
|
601
602
|
focusedIndex: l + i,
|
|
602
603
|
focusedType: 1
|
|
@@ -604,13 +605,13 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
604
605
|
};
|
|
605
606
|
if (g.length) {
|
|
606
607
|
const d = g[g.length - 1];
|
|
607
|
-
return l = r.findIndex((h) =>
|
|
608
|
+
return l = r.findIndex((h) => M(h, d, o)), r[l] !== void 0 ? {
|
|
608
609
|
focusedIndex: l + i,
|
|
609
610
|
focusedItem: r[l],
|
|
610
611
|
focusedType: 1
|
|
611
612
|
/* ListItem */
|
|
612
613
|
} : { focusedType: 0, focusedIndex: -1 };
|
|
613
|
-
} else if (c && a && !
|
|
614
|
+
} else if (c && a && !t && i === 0) {
|
|
614
615
|
const d = r.findIndex((h) => !h.disabled && h[a]);
|
|
615
616
|
return {
|
|
616
617
|
focusedIndex: d,
|
|
@@ -633,8 +634,8 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
633
634
|
this.base.applyState(n), this._valueItemsDuringOnChange = null;
|
|
634
635
|
}
|
|
635
636
|
calculateMedia(n) {
|
|
636
|
-
for (const
|
|
637
|
-
this.setState({ windowWidth:
|
|
637
|
+
for (const t of n)
|
|
638
|
+
this.setState({ windowWidth: t.target.clientWidth });
|
|
638
639
|
}
|
|
639
640
|
/**
|
|
640
641
|
* Updates the state of the MultiSelect when the complex keyboard navigation that
|
|
@@ -643,16 +644,16 @@ const { sizeMap: T, roundedMap: bt } = it, yt = "Please enter a valid value!", $
|
|
|
643
644
|
* @param {Array<string | Object>} dataToSet Defines the array of new values that will be applied to the MultiSelect
|
|
644
645
|
* @param {MultiSelectInternalState} state The current state of the MultiSelect
|
|
645
646
|
*/
|
|
646
|
-
updateStateOnKeyboardNavigation(n,
|
|
647
|
-
this.setState({ value: n }), this.triggerOnChange(n,
|
|
647
|
+
updateStateOnKeyboardNavigation(n, t) {
|
|
648
|
+
this.setState({ value: n }), this.triggerOnChange(n, t), this.applyState(t);
|
|
648
649
|
}
|
|
649
650
|
/**
|
|
650
651
|
* Returns the last element that was selected or deselected. Needed for the keyboard navigation specifications
|
|
651
652
|
*
|
|
652
653
|
* @param {number} correction A correction is needed depending on if UP or DOWN key is pressed
|
|
653
654
|
*/
|
|
654
|
-
getLastSelectedOrDeselectedIndex(n,
|
|
655
|
-
return this._lastSelectedOrDeslectedItemIndex === null && (this._lastSelectedOrDeslectedItemIndex =
|
|
655
|
+
getLastSelectedOrDeselectedIndex(n, t) {
|
|
656
|
+
return this._lastSelectedOrDeslectedItemIndex === null && (this._lastSelectedOrDeslectedItemIndex = t), this._lastSelectedOrDeslectedItemIndex !== null ? this._lastSelectedOrDeslectedItemIndex + n : null;
|
|
656
657
|
}
|
|
657
658
|
};
|
|
658
659
|
y.displayName = "MultiSelect", y.propTypes = {
|
|
@@ -692,10 +693,10 @@ y.displayName = "MultiSelect", y.propTypes = {
|
|
|
692
693
|
suffix: void 0
|
|
693
694
|
};
|
|
694
695
|
let P = y;
|
|
695
|
-
const xt =
|
|
696
|
-
|
|
696
|
+
const xt = Z(), St = tt(
|
|
697
|
+
et(
|
|
697
698
|
xt,
|
|
698
|
-
P
|
|
699
|
+
st(P)
|
|
699
700
|
)
|
|
700
701
|
);
|
|
701
702
|
St.displayName = "KendoReactMultiSelect";
|