@progress/kendo-react-dropdowns 9.5.0 → 10.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.js +1 -1
- package/AutoComplete/AutoComplete.mjs +251 -252
- package/ComboBox/ComboBox.js +1 -1
- package/ComboBox/ComboBox.mjs +53 -52
- package/DropDownList/DropDownList.js +1 -1
- package/DropDownList/DropDownList.mjs +217 -210
- package/DropDownTree/DropDownTree.js +1 -1
- package/DropDownTree/DropDownTree.mjs +91 -91
- package/MultiSelect/MultiSelect.js +1 -1
- package/MultiSelect/MultiSelect.mjs +114 -105
- package/MultiSelectTree/MultiSelectTree.js +1 -1
- package/MultiSelectTree/MultiSelectTree.mjs +222 -223
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/index.d.mts +8 -3
- package/index.d.ts +8 -3
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
|
@@ -5,178 +5,177 @@
|
|
|
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
|
|
8
|
+
import * as c from "react";
|
|
9
|
+
import g from "prop-types";
|
|
10
10
|
import N from "../common/SearchBar.mjs";
|
|
11
11
|
import R from "../common/ListContainer.mjs";
|
|
12
12
|
import z from "../common/List.mjs";
|
|
13
|
-
import
|
|
13
|
+
import C from "../common/DropDownBase.mjs";
|
|
14
14
|
import L from "../common/GroupStickyHeader.mjs";
|
|
15
|
-
import { getFilteredData as
|
|
16
|
-
import { classNames as
|
|
17
|
-
import { FloatingLabel as
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
super(a), this.state = {}, this.base = new S(this), this._element = null, this._suggested = "", this._input = null, this._adaptiveInput = null, this._skipFocusEvent = !1, this._isScrolling = !1, this.itemHeight = 0, this.focus = () => {
|
|
15
|
+
import { getFilteredData as b, getItemValue as y, areSame as S, isPresent as H, getFocusedItem as M, itemIndexStartsWith as A } from "../common/utils.mjs";
|
|
16
|
+
import { classNames as w, Keys as m, canUseDOM as D, IconWrap as K, createPropsContext as q, withIdHOC as W, withPropsContext as G, withAdaptiveModeContext as U, kendoThemeMaps as $ } from "@progress/kendo-react-common";
|
|
17
|
+
import { FloatingLabel as j } from "@progress/kendo-react-labels";
|
|
18
|
+
import J from "../common/ClearButton.mjs";
|
|
19
|
+
import { AdaptiveMode as Q } from "../common/AdaptiveMode.mjs";
|
|
20
|
+
import E from "../common/withCustomComponent.mjs";
|
|
21
|
+
import { ActionSheetContent as X } from "@progress/kendo-react-layout";
|
|
22
|
+
import Y from "../common/ListFilter.mjs";
|
|
23
|
+
const Z = "Please enter a valid value!", { sizeMap: O, roundedMap: ee } = $, I = class I extends c.Component {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments), this.state = {}, this.base = new C(this), this._element = null, this._suggested = "", this._input = null, this._adaptiveInput = null, this._skipFocusEvent = !1, this._isScrolling = !1, this.itemHeight = 0, this.focus = () => {
|
|
27
26
|
this._input && this._input.focus();
|
|
28
27
|
}, this.handleItemSelect = (e, t) => {
|
|
29
|
-
const s =
|
|
30
|
-
this.state.text && !this.mobileMode && (this.state.text && (t.data.text = ""), this.base.filterChanged("", t)), this._adaptiveInput && this._adaptiveInput.blur(), this.triggerOnChange(
|
|
28
|
+
const s = b(this.props), n = y(s[e], this.props.textField);
|
|
29
|
+
this.state.text && !this.mobileMode && (this.state.text && (t.data.text = ""), this.base.filterChanged("", t)), this._adaptiveInput && this._adaptiveInput.blur(), this.triggerOnChange(n, t);
|
|
31
30
|
}, this.itemFocus = (e, t) => {
|
|
32
|
-
const { textField: s } = this.props,
|
|
33
|
-
|
|
31
|
+
const { textField: s } = this.props, i = b(this.props)[e];
|
|
32
|
+
S(this.state.focusedItem, i, s) || (t.data.focusedItem = i);
|
|
34
33
|
}, this.togglePopup = (e) => {
|
|
35
34
|
this.base.togglePopup(e);
|
|
36
35
|
}, this.setValidity = () => {
|
|
37
36
|
this._input && this._input.setCustomValidity && this._input.setCustomValidity(
|
|
38
|
-
this.validity.valid ? "" : this.props.validationMessage ||
|
|
37
|
+
this.validity.valid ? "" : this.props.validationMessage || Z
|
|
39
38
|
);
|
|
40
39
|
}, this.renderAdaptiveListContainer = () => {
|
|
41
|
-
const { adaptiveTitle: e } = this.props, { windowWidth: t = 0 } = this.state, s = /* @__PURE__ */
|
|
42
|
-
|
|
40
|
+
const { adaptiveTitle: e } = this.props, { windowWidth: t = 0 } = this.state, s = /* @__PURE__ */ c.createElement(
|
|
41
|
+
Y,
|
|
43
42
|
{
|
|
44
43
|
value: this.value,
|
|
45
|
-
ref: (
|
|
44
|
+
ref: (i) => this._adaptiveInput = i && i.element,
|
|
46
45
|
onChange: this.onChangeHandler,
|
|
47
46
|
onKeyDown: this.onInputKeyDown,
|
|
48
47
|
size: this.props.size,
|
|
49
48
|
rounded: this.props.rounded,
|
|
50
49
|
fillMode: this.props.fillMode
|
|
51
50
|
}
|
|
52
|
-
),
|
|
51
|
+
), n = {
|
|
53
52
|
title: e,
|
|
54
53
|
expand: this.opened,
|
|
55
|
-
onClose: (
|
|
54
|
+
onClose: (i) => this.onCancel(i),
|
|
56
55
|
windowWidth: t,
|
|
57
56
|
mobileFilter: s
|
|
58
57
|
};
|
|
59
|
-
return /* @__PURE__ */
|
|
58
|
+
return /* @__PURE__ */ c.createElement(Q, { ...n }, /* @__PURE__ */ c.createElement(X, { overflowHidden: !0 }, /* @__PURE__ */ c.createElement("div", { className: "k-list-container" }, this.listContainerContent())));
|
|
60
59
|
}, this.onCancel = (e) => {
|
|
61
60
|
const t = this.base.initState();
|
|
62
61
|
t.syntheticEvent = e, e.stopPropagation(), this.opened && this.base.togglePopup(t), t.events.push({ type: "onCancel" });
|
|
63
62
|
const s = this.state.text;
|
|
64
63
|
H(s) && s !== "" && this.base.filterChanged("", t), this.state.text && (t.data.text = ""), this.applyState(t);
|
|
65
64
|
}, this.listContainerContent = () => {
|
|
66
|
-
const { header: e, footer: t, size: s, groupStickyHeaderItemRender:
|
|
67
|
-
let { group:
|
|
68
|
-
return
|
|
65
|
+
const { header: e, footer: t, size: s, groupStickyHeaderItemRender: n, groupField: i, list: a } = this.props, d = b(this.props);
|
|
66
|
+
let { group: o } = this.state;
|
|
67
|
+
return o === void 0 && i !== void 0 && (o = y(d[0], i)), /* @__PURE__ */ c.createElement(c.Fragment, null, e && /* @__PURE__ */ c.createElement("div", { className: "k-list-header" }, e), /* @__PURE__ */ c.createElement(
|
|
69
68
|
"div",
|
|
70
69
|
{
|
|
71
|
-
className:
|
|
70
|
+
className: w("k-list", {
|
|
72
71
|
[`k-list-${this.mobileMode ? "lg" : O[s] || s}`]: s
|
|
73
72
|
})
|
|
74
73
|
},
|
|
75
|
-
!
|
|
74
|
+
!a && o && d.length !== 0 && /* @__PURE__ */ c.createElement(L, { group: o, groupMode: "modern", render: n }),
|
|
76
75
|
this.renderList()
|
|
77
|
-
), t && /* @__PURE__ */
|
|
76
|
+
), t && /* @__PURE__ */ c.createElement("div", { className: "k-list-footer" }, t));
|
|
78
77
|
}, this.onScroll = (e) => {
|
|
79
78
|
this._isScrolling = !0;
|
|
80
79
|
const { list: t } = this.base, { groupField: s } = this.props;
|
|
81
|
-
let
|
|
82
|
-
if (!s || !
|
|
80
|
+
let n = b(this.props);
|
|
81
|
+
if (!s || !n.length)
|
|
83
82
|
return;
|
|
84
|
-
const
|
|
85
|
-
s && (
|
|
86
|
-
let
|
|
87
|
-
for (let
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
group:
|
|
83
|
+
const i = this.itemHeight || (t ? t.children[0].offsetHeight : 0), d = e.target.scrollTop;
|
|
84
|
+
s && (n = this.base.getGroupedDataModernMode(n, s));
|
|
85
|
+
let o = n[0][s];
|
|
86
|
+
for (let r = 1; r < n.length && !(i * r > d); r++)
|
|
87
|
+
n[r] && n[r][s] && (o = n[r][s]);
|
|
88
|
+
o !== this.state.group && this.setState({
|
|
89
|
+
group: o
|
|
91
90
|
});
|
|
92
91
|
}, this.handleItemClick = (e, t) => {
|
|
93
92
|
this.base.handleItemClick(e, t), this._valueDuringOnChange = void 0;
|
|
94
93
|
}, this.onChangeHandler = (e) => {
|
|
95
|
-
const s = this.base.initState(),
|
|
94
|
+
const s = this.base.initState(), n = this.mobileMode ? e.target.element : e.currentTarget, i = n.value, a = n.selectionEnd === i.length;
|
|
96
95
|
s.syntheticEvent = e;
|
|
97
|
-
const
|
|
98
|
-
if (
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
this.triggerOnChange(
|
|
96
|
+
const d = this._suggested, o = this.value, r = o && o.substring(0, o.length - d.length), l = r && r === i, h = r && r.length > i.length, { suggest: v } = this.props, p = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
|
|
97
|
+
if (v !== void 0 && v !== !1) {
|
|
98
|
+
l || h || !a ? this._suggested = "" : this.suggestValue(i);
|
|
99
|
+
const u = i + this._suggested, f = { userInput: i, value: this._suggested };
|
|
100
|
+
this.triggerOnChange(u, s, { suggestion: f });
|
|
102
101
|
} else
|
|
103
|
-
this._suggested = "", this.triggerOnChange(
|
|
104
|
-
(!
|
|
102
|
+
this._suggested = "", this.triggerOnChange(i, s);
|
|
103
|
+
(!p && i || p && !i) && this.togglePopup(s), s.data.focusedItem = void 0, this.applyState(s), this.setState({ group: void 0 });
|
|
105
104
|
}, this.clearButtonClick = (e) => {
|
|
106
|
-
const s = this.base.initState(),
|
|
105
|
+
const s = this.base.initState(), n = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
|
|
107
106
|
s.syntheticEvent = e;
|
|
108
|
-
const
|
|
109
|
-
this._suggested = "", this.triggerOnChange(
|
|
107
|
+
const i = "";
|
|
108
|
+
this._suggested = "", this.triggerOnChange(i, s), this.state.focusedItem !== void 0 && (s.data.focusedItem = void 0), n && this.togglePopup(s), this.applyState(s);
|
|
110
109
|
}, this.onInputKeyDown = (e) => {
|
|
111
|
-
const { skipDisabledItems: t, groupField: s, textField:
|
|
110
|
+
const { skipDisabledItems: t, groupField: s, textField: n } = this.props, i = b(this.props);
|
|
112
111
|
this._isScrolling && (this._isScrolling = !1);
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
|
|
112
|
+
const a = this.focusedIndex(), d = i[a], o = e.keyCode, r = e.altKey, l = this.props.opened !== void 0 ? this.props.opened : this.state.opened, h = this.base.initState();
|
|
113
|
+
h.syntheticEvent = e;
|
|
114
|
+
const v = () => {
|
|
115
|
+
l && e.preventDefault();
|
|
117
116
|
};
|
|
118
|
-
if (
|
|
117
|
+
if (r && o === m.down)
|
|
119
118
|
this.setState({
|
|
120
119
|
opened: !0
|
|
121
120
|
});
|
|
122
|
-
else if (
|
|
121
|
+
else if (r && o === m.up)
|
|
123
122
|
this.setState({
|
|
124
123
|
opened: !1
|
|
125
124
|
});
|
|
126
|
-
else if (
|
|
127
|
-
|
|
128
|
-
else if (
|
|
129
|
-
|
|
130
|
-
else if (
|
|
131
|
-
|
|
132
|
-
else if (!
|
|
133
|
-
const
|
|
134
|
-
this._suggested = "", this.triggerOnChange(
|
|
135
|
-
} else if (
|
|
136
|
-
if (s !== "" &&
|
|
137
|
-
if (!this.props.skipDisabledItems &&
|
|
138
|
-
this.onNavigate(
|
|
125
|
+
else if (l && o === m.pageUp)
|
|
126
|
+
v(), this.base.scrollPopupByPageSize(-1);
|
|
127
|
+
else if (l && o === m.pageDown)
|
|
128
|
+
v(), this.base.scrollPopupByPageSize(1);
|
|
129
|
+
else if (l && (o === m.enter || o === m.esc))
|
|
130
|
+
v(), t === !1 && d && d.disabled ? (l && this.togglePopup(h), this.applyState(h)) : this.applyInputValue(e.currentTarget.value, h, e.keyCode);
|
|
131
|
+
else if (!l && o === m.esc) {
|
|
132
|
+
const p = "";
|
|
133
|
+
this._suggested = "", this.triggerOnChange(p, h), this.state.focusedItem !== void 0 && (h.data.focusedItem = void 0), this.applyState(h);
|
|
134
|
+
} else if (o === m.up || o === m.down) {
|
|
135
|
+
if (s !== "" && n)
|
|
136
|
+
if (!this.props.skipDisabledItems && l)
|
|
137
|
+
this.onNavigate(h, o);
|
|
139
138
|
else {
|
|
140
|
-
let
|
|
141
|
-
if (
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
} else if (
|
|
145
|
-
let
|
|
146
|
-
if (
|
|
147
|
-
|
|
139
|
+
let p = 0;
|
|
140
|
+
if (o === m.down || o === m.right) {
|
|
141
|
+
const u = i.slice(a + 1).find((f) => !f.disabled && f[n]);
|
|
142
|
+
p = u && i.findIndex((f) => f[n] === u[n]);
|
|
143
|
+
} else if (o === m.up || o === m.left) {
|
|
144
|
+
let u;
|
|
145
|
+
if (a === -1)
|
|
146
|
+
u = i, p = i.findIndex((f) => !f.disabled && f[n]);
|
|
148
147
|
else {
|
|
149
|
-
|
|
150
|
-
let
|
|
151
|
-
for (;
|
|
152
|
-
|
|
153
|
-
|
|
148
|
+
u = i.slice(0, a);
|
|
149
|
+
let f = u.pop();
|
|
150
|
+
for (; f && f.disabled; )
|
|
151
|
+
f = u.pop();
|
|
152
|
+
p = f && i.findIndex((x) => x[n] === f[n]);
|
|
154
153
|
}
|
|
155
154
|
}
|
|
156
|
-
if (
|
|
157
|
-
const
|
|
158
|
-
this.onNavigate(
|
|
155
|
+
if (p !== void 0) {
|
|
156
|
+
const u = p - a;
|
|
157
|
+
this.onNavigate(h, o, u);
|
|
159
158
|
} else
|
|
160
|
-
|
|
159
|
+
p === void 0 && i.findIndex((u) => u[n]) === i.length - 1 && this.onNavigate(h, o);
|
|
161
160
|
}
|
|
162
|
-
else if (!this.props.skipDisabledItems &&
|
|
163
|
-
this.onNavigate(
|
|
161
|
+
else if (!this.props.skipDisabledItems && l)
|
|
162
|
+
this.onNavigate(h, o);
|
|
164
163
|
else {
|
|
165
|
-
let
|
|
166
|
-
if (
|
|
167
|
-
|
|
168
|
-
else if (
|
|
169
|
-
const
|
|
170
|
-
for (
|
|
171
|
-
|
|
164
|
+
let p = null;
|
|
165
|
+
if (o === m.down || o === m.right)
|
|
166
|
+
p = i.slice(a + 1).find((u) => !u.disabled);
|
|
167
|
+
else if (o === m.up || o === m.left) {
|
|
168
|
+
const u = i.slice(0, a);
|
|
169
|
+
for (p = u.pop(); p && p.disabled; )
|
|
170
|
+
p = u.pop();
|
|
172
171
|
}
|
|
173
|
-
if (
|
|
174
|
-
const
|
|
175
|
-
this.onNavigate(
|
|
172
|
+
if (p) {
|
|
173
|
+
const u = p.id - a - 1;
|
|
174
|
+
this.onNavigate(h, o, u);
|
|
176
175
|
} else
|
|
177
|
-
this.onNavigate(
|
|
176
|
+
this.onNavigate(h, o);
|
|
178
177
|
}
|
|
179
|
-
this.applyState(
|
|
178
|
+
this.applyState(h), v();
|
|
180
179
|
}
|
|
181
180
|
}, this.handleFocus = (e) => {
|
|
182
181
|
this._skipFocusEvent || this.base.handleFocus(e);
|
|
@@ -188,13 +187,13 @@ const te = "Please enter a valid value!", { sizeMap: O, roundedMap: se } = j, y
|
|
|
188
187
|
!this.opened && t && this.focusElement(t);
|
|
189
188
|
const s = this.base.initState();
|
|
190
189
|
s.syntheticEvent = e, !this.state.focused && !this.mobileMode && (s.events.push({ type: "onFocus" }), s.data.focused = !0), this.mobileMode && window.setTimeout(() => this._adaptiveInput && this._adaptiveInput.focus(), 300), this.base.togglePopup(s), this.applyState(s);
|
|
191
|
-
}
|
|
190
|
+
};
|
|
192
191
|
}
|
|
193
192
|
get _inputId() {
|
|
194
193
|
return this.props.id + "-accessibility-id";
|
|
195
194
|
}
|
|
196
195
|
get document() {
|
|
197
|
-
if (
|
|
196
|
+
if (D)
|
|
198
197
|
return this.element && this.element.ownerDocument || document;
|
|
199
198
|
}
|
|
200
199
|
/**
|
|
@@ -219,10 +218,10 @@ const te = "Please enter a valid value!", { sizeMap: O, roundedMap: se } = j, y
|
|
|
219
218
|
* Represents the validity state into which the AutoComplete is set.
|
|
220
219
|
*/
|
|
221
220
|
get validity() {
|
|
222
|
-
const
|
|
221
|
+
const e = this.props.validationMessage !== void 0, t = !this.required || this.value !== "", s = this.props.valid !== void 0 ? this.props.valid : t;
|
|
223
222
|
return {
|
|
224
|
-
customError:
|
|
225
|
-
valid:
|
|
223
|
+
customError: e,
|
|
224
|
+
valid: s,
|
|
226
225
|
valueMissing: this.value === null
|
|
227
226
|
};
|
|
228
227
|
}
|
|
@@ -234,32 +233,32 @@ const te = "Please enter a valid value!", { sizeMap: O, roundedMap: se } = j, y
|
|
|
234
233
|
* The mobile mode of the AutoComplete.
|
|
235
234
|
*/
|
|
236
235
|
get mobileMode() {
|
|
237
|
-
var
|
|
238
|
-
return !!(this.state.windowWidth && this.props._adaptiveMode && this.state.windowWidth <= ((
|
|
236
|
+
var t;
|
|
237
|
+
return !!(this.state.windowWidth && this.props._adaptiveMode && this.state.windowWidth <= ((t = this.props._adaptiveMode) == null ? void 0 : t.medium) && this.props.adaptive);
|
|
239
238
|
}
|
|
240
239
|
/**
|
|
241
240
|
* @hidden
|
|
242
241
|
*/
|
|
243
242
|
get validityStyles() {
|
|
244
|
-
return this.props.validityStyles !== void 0 ? this.props.validityStyles :
|
|
243
|
+
return this.props.validityStyles !== void 0 ? this.props.validityStyles : I.defaultProps.validityStyles;
|
|
245
244
|
}
|
|
246
245
|
/**
|
|
247
246
|
* @hidden
|
|
248
247
|
*/
|
|
249
248
|
get required() {
|
|
250
|
-
return this.props.required !== void 0 ? this.props.required :
|
|
249
|
+
return this.props.required !== void 0 ? this.props.required : I.defaultProps.required;
|
|
251
250
|
}
|
|
252
251
|
/**
|
|
253
252
|
* @hidden
|
|
254
253
|
*/
|
|
255
|
-
componentDidUpdate(
|
|
256
|
-
var
|
|
257
|
-
const { groupField:
|
|
258
|
-
if (
|
|
259
|
-
(
|
|
254
|
+
componentDidUpdate(e, t) {
|
|
255
|
+
var p;
|
|
256
|
+
const { groupField: s = "" } = this.props, n = b(this.props), { data: i = [] } = e, a = this.focusedIndex(), d = n[a], o = i !== n, r = d !== void 0 && t.focusedItem !== d, l = this.props.opened !== void 0 ? this.props.opened : this.state.opened, h = e.opened !== void 0 ? e.opened : t.opened, v = !h && l;
|
|
257
|
+
if (s === "")
|
|
258
|
+
(l && (r || o) || v) && this.base.scrollToItem(a);
|
|
260
259
|
else if (!this._isScrolling) {
|
|
261
|
-
const
|
|
262
|
-
|
|
260
|
+
const u = (p = this.base.getGroupedDataModernMode(n, s)) == null ? void 0 : p.indexOf(d);
|
|
261
|
+
v && (n && n.length !== 0 && this.base.resetGroupStickyHeader(n[0][s], this), this.base.scrollToItem(u)), l && h && r && this.base.scrollToItem(u);
|
|
263
262
|
}
|
|
264
263
|
this.setValidity();
|
|
265
264
|
}
|
|
@@ -267,8 +266,8 @@ const te = "Please enter a valid value!", { sizeMap: O, roundedMap: se } = j, y
|
|
|
267
266
|
* @hidden
|
|
268
267
|
*/
|
|
269
268
|
componentDidMount() {
|
|
270
|
-
var
|
|
271
|
-
this.observerResize =
|
|
269
|
+
var e;
|
|
270
|
+
this.observerResize = D && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this)), this.base.didMount(), this.setValidity(), (e = this.document) != null && e.body && this.observerResize && this.observerResize.observe(this.document.body);
|
|
272
271
|
}
|
|
273
272
|
/**
|
|
274
273
|
* @hidden
|
|
@@ -280,211 +279,211 @@ const te = "Please enter a valid value!", { sizeMap: O, roundedMap: se } = j, y
|
|
|
280
279
|
* @hidden
|
|
281
280
|
*/
|
|
282
281
|
render() {
|
|
283
|
-
const { dir:
|
|
282
|
+
const { dir: e, disabled: t, label: s, className: n, style: i, loading: a, suggest: d, size: o, rounded: r, fillMode: l } = this.props, h = !this.validityStyles || this.validity.valid, v = this.base, p = this.value, u = this.props.clearButton !== !1 && !a && !!p, f = this.props.id || this._inputId, x = this.state.focused;
|
|
284
283
|
typeof d == "string" && (this._suggested = d);
|
|
285
|
-
const [
|
|
284
|
+
const [P, B] = E(this.props.prefix || c.Fragment), [T, V] = E(this.props.suffix || c.Fragment), _ = /* @__PURE__ */ c.createElement(c.Fragment, null, /* @__PURE__ */ c.createElement(
|
|
286
285
|
"span",
|
|
287
286
|
{
|
|
288
|
-
className:
|
|
289
|
-
[`k-input-${O[
|
|
290
|
-
[`k-rounded-${
|
|
291
|
-
[`k-input-${
|
|
292
|
-
"k-invalid": !
|
|
293
|
-
"k-focus":
|
|
294
|
-
"k-loading":
|
|
287
|
+
className: w("k-autocomplete k-input", n, {
|
|
288
|
+
[`k-input-${O[o] || o}`]: o,
|
|
289
|
+
[`k-rounded-${ee[r] || r}`]: r,
|
|
290
|
+
[`k-input-${l}`]: l,
|
|
291
|
+
"k-invalid": !h,
|
|
292
|
+
"k-focus": x && !t,
|
|
293
|
+
"k-loading": a,
|
|
295
294
|
"k-required": this.required,
|
|
296
|
-
"k-disabled":
|
|
295
|
+
"k-disabled": t
|
|
297
296
|
}),
|
|
298
|
-
ref: (
|
|
299
|
-
this._element =
|
|
297
|
+
ref: (F) => {
|
|
298
|
+
this._element = F, v.wrapper = F;
|
|
300
299
|
},
|
|
301
|
-
style:
|
|
302
|
-
dir:
|
|
300
|
+
style: s ? { ...i, width: void 0 } : i,
|
|
301
|
+
dir: e,
|
|
303
302
|
onFocus: this.handleFocus,
|
|
304
303
|
onBlur: this.handleBlur,
|
|
305
304
|
onClick: this.handleWrapperClick
|
|
306
305
|
},
|
|
307
|
-
this.props.prefix && /* @__PURE__ */
|
|
308
|
-
this.renderSearchBar(
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
this.props.suffix && /* @__PURE__ */
|
|
306
|
+
this.props.prefix && /* @__PURE__ */ c.createElement(P, { ...B }),
|
|
307
|
+
this.renderSearchBar(p || "", f),
|
|
308
|
+
a && /* @__PURE__ */ c.createElement(K, { className: "k-input-loading-icon", name: "loading" }),
|
|
309
|
+
u && !a && /* @__PURE__ */ c.createElement(J, { onClick: this.clearButtonClick, key: "clearbutton" }),
|
|
310
|
+
this.props.suffix && /* @__PURE__ */ c.createElement(T, { ...V }),
|
|
312
311
|
!this.mobileMode && this.renderListContainer()
|
|
313
312
|
), this.mobileMode && this.renderAdaptiveListContainer());
|
|
314
|
-
return
|
|
315
|
-
|
|
313
|
+
return s ? /* @__PURE__ */ c.createElement(
|
|
314
|
+
j,
|
|
316
315
|
{
|
|
317
|
-
label:
|
|
318
|
-
editorId:
|
|
319
|
-
editorValue:
|
|
320
|
-
editorValid:
|
|
321
|
-
editorDisabled:
|
|
316
|
+
label: s,
|
|
317
|
+
editorId: f,
|
|
318
|
+
editorValue: p,
|
|
319
|
+
editorValid: h,
|
|
320
|
+
editorDisabled: t,
|
|
322
321
|
style: { width: i ? i.width : void 0 },
|
|
323
|
-
children:
|
|
322
|
+
children: _
|
|
324
323
|
}
|
|
325
|
-
) :
|
|
324
|
+
) : _;
|
|
326
325
|
}
|
|
327
326
|
/**
|
|
328
327
|
* @hidden
|
|
329
328
|
*/
|
|
330
|
-
onNavigate(
|
|
331
|
-
const
|
|
332
|
-
keyCode:
|
|
333
|
-
current:
|
|
329
|
+
onNavigate(e, t, s) {
|
|
330
|
+
const n = this.value, { textField: i, focusedItemIndex: a } = this.props, d = b(this.props), o = this.state.focusedItem !== void 0 ? d.findIndex((l) => S(l, this.state.focusedItem, i)) : a ? a(d, n, i) : d.indexOf(M(d, n, i)), r = this.base.navigation.navigate({
|
|
331
|
+
keyCode: t,
|
|
332
|
+
current: o,
|
|
334
333
|
max: d.length - 1,
|
|
335
334
|
min: 0,
|
|
336
|
-
skipItems:
|
|
335
|
+
skipItems: s || void 0
|
|
337
336
|
});
|
|
338
|
-
|
|
337
|
+
r !== void 0 && this.itemFocus(r, e), this.applyState(e);
|
|
339
338
|
}
|
|
340
339
|
/**
|
|
341
340
|
* @hidden
|
|
342
341
|
*/
|
|
343
|
-
applyInputValue(
|
|
344
|
-
const
|
|
345
|
-
if (this._suggested = "",
|
|
346
|
-
const
|
|
347
|
-
this.triggerOnChange(
|
|
342
|
+
applyInputValue(e, t, s) {
|
|
343
|
+
const n = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { textField: i } = this.props, a = b(this.props), d = this.focusedIndex(), o = a[d];
|
|
344
|
+
if (this._suggested = "", n && s === m.enter && o && !o.disabled) {
|
|
345
|
+
const r = y(a[this.focusedIndex(e)], i);
|
|
346
|
+
this.triggerOnChange(r, t);
|
|
348
347
|
}
|
|
349
|
-
|
|
348
|
+
n && this.togglePopup(t), this.applyState(t);
|
|
350
349
|
}
|
|
351
|
-
renderSearchBar(
|
|
352
|
-
const
|
|
353
|
-
return /* @__PURE__ */
|
|
350
|
+
renderSearchBar(e, t) {
|
|
351
|
+
const s = this.base, { placeholder: n, tabIndex: i, disabled: a, readonly: d, inputAttributes: o } = this.props, { focused: r } = this.state, l = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
|
|
352
|
+
return /* @__PURE__ */ c.createElement(
|
|
354
353
|
N,
|
|
355
354
|
{
|
|
356
|
-
id:
|
|
357
|
-
placeholder:
|
|
355
|
+
id: t,
|
|
356
|
+
placeholder: n,
|
|
358
357
|
tabIndex: i,
|
|
359
358
|
accessKey: this.props.accessKey,
|
|
360
|
-
value:
|
|
359
|
+
value: e,
|
|
361
360
|
suggestedText: this._suggested,
|
|
362
|
-
focused:
|
|
361
|
+
focused: r,
|
|
363
362
|
name: this.props.name,
|
|
364
|
-
ref: (
|
|
363
|
+
ref: (h) => this._input = h && h.input,
|
|
365
364
|
onKeyDown: this.onInputKeyDown,
|
|
366
365
|
onChange: this.onChangeHandler,
|
|
367
|
-
onFocus:
|
|
366
|
+
onFocus: s.handleFocus,
|
|
368
367
|
onBlur: this.handleBlur,
|
|
369
|
-
disabled:
|
|
368
|
+
disabled: a,
|
|
370
369
|
readOnly: d,
|
|
371
|
-
expanded:
|
|
372
|
-
owns:
|
|
373
|
-
activedescendant: "option-" +
|
|
370
|
+
expanded: l,
|
|
371
|
+
owns: s.listBoxId,
|
|
372
|
+
activedescendant: "option-" + s.guid + "-" + this.focusedIndex(),
|
|
374
373
|
role: "combobox",
|
|
375
374
|
ariaLabelledBy: this.props.ariaLabelledBy,
|
|
376
375
|
ariaDescribedBy: this.props.ariaDescribedBy,
|
|
377
376
|
ariaRequired: this.required,
|
|
378
377
|
render: this.props.valueRender,
|
|
379
|
-
inputAttributes:
|
|
378
|
+
inputAttributes: o
|
|
380
379
|
}
|
|
381
380
|
);
|
|
382
381
|
}
|
|
383
382
|
renderListContainer() {
|
|
384
|
-
const
|
|
385
|
-
let { group:
|
|
386
|
-
return
|
|
383
|
+
const e = this.base, { dir: t, groupField: s } = this.props, n = b(this.props), i = e.getPopupSettings(), a = this.props.opened !== void 0 ? this.props.opened : this.state.opened, d = i.width !== void 0 ? i.width : e.popupWidth;
|
|
384
|
+
let { group: o } = this.state;
|
|
385
|
+
return o === void 0 && s !== void 0 && (o = y(n[0], s)), /* @__PURE__ */ c.createElement(
|
|
387
386
|
R,
|
|
388
387
|
{
|
|
389
388
|
width: d,
|
|
390
389
|
popupSettings: {
|
|
391
390
|
...i,
|
|
392
391
|
anchor: i.anchor || this.element,
|
|
393
|
-
show:
|
|
394
|
-
popupClass:
|
|
392
|
+
show: a,
|
|
393
|
+
popupClass: w(i.popupClass, "k-list-container", "k-autocomplete-popup")
|
|
395
394
|
},
|
|
396
|
-
dir:
|
|
397
|
-
itemsCount: [
|
|
395
|
+
dir: t !== void 0 ? t : this.base.dirCalculated,
|
|
396
|
+
itemsCount: [n.length]
|
|
398
397
|
},
|
|
399
398
|
this.listContainerContent()
|
|
400
399
|
);
|
|
401
400
|
}
|
|
402
401
|
renderList() {
|
|
403
|
-
const
|
|
404
|
-
return /* @__PURE__ */
|
|
402
|
+
const e = this.base, t = e.getPopupSettings(), { textField: s, listNoDataRender: n, itemRender: i, groupHeaderItemRender: a } = this.props, d = b(this.props), o = this.value, r = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
|
|
403
|
+
return /* @__PURE__ */ c.createElement(
|
|
405
404
|
z,
|
|
406
405
|
{
|
|
407
|
-
id:
|
|
408
|
-
show:
|
|
406
|
+
id: e.listBoxId,
|
|
407
|
+
show: r,
|
|
409
408
|
data: d.slice(),
|
|
410
409
|
focusedIndex: this.focusedIndex(),
|
|
411
|
-
value:
|
|
412
|
-
textField:
|
|
413
|
-
valueField:
|
|
410
|
+
value: o,
|
|
411
|
+
textField: s,
|
|
412
|
+
valueField: s,
|
|
414
413
|
highlightSelected: !1,
|
|
415
|
-
optionsGuid:
|
|
414
|
+
optionsGuid: e.guid,
|
|
416
415
|
groupField: this.props.groupField,
|
|
417
416
|
groupMode: "modern",
|
|
418
|
-
listRef: (
|
|
419
|
-
wrapperStyle: this.mobileMode ? {} : { maxHeight:
|
|
417
|
+
listRef: (l) => e.list = l,
|
|
418
|
+
wrapperStyle: this.mobileMode ? {} : { maxHeight: t.height },
|
|
420
419
|
wrapperCssClass: "k-list-content",
|
|
421
420
|
onClick: this.handleItemClick,
|
|
422
421
|
itemRender: i,
|
|
423
|
-
groupHeaderItemRender:
|
|
424
|
-
noDataRender:
|
|
425
|
-
onMouseDown: (
|
|
422
|
+
groupHeaderItemRender: a,
|
|
423
|
+
noDataRender: n,
|
|
424
|
+
onMouseDown: (l) => l.preventDefault(),
|
|
426
425
|
onScroll: this.onScroll
|
|
427
426
|
}
|
|
428
427
|
);
|
|
429
428
|
}
|
|
430
|
-
triggerOnChange(
|
|
431
|
-
this.value ===
|
|
429
|
+
triggerOnChange(e, t, s) {
|
|
430
|
+
this.value === e && !s || (t.data.value = e, this._valueDuringOnChange = e, t.events.push({ type: "onChange", ...s || {} }));
|
|
432
431
|
}
|
|
433
|
-
focusElement(
|
|
434
|
-
this._skipFocusEvent = !0,
|
|
432
|
+
focusElement(e) {
|
|
433
|
+
this._skipFocusEvent = !0, e.focus(), window.setTimeout(() => this._skipFocusEvent = !1, 0);
|
|
435
434
|
}
|
|
436
|
-
applyState(
|
|
437
|
-
this.base.applyState(
|
|
435
|
+
applyState(e) {
|
|
436
|
+
this.base.applyState(e), this._valueDuringOnChange = void 0;
|
|
438
437
|
}
|
|
439
|
-
suggestValue(
|
|
440
|
-
if (this._suggested = "",
|
|
441
|
-
const { textField:
|
|
442
|
-
if (
|
|
443
|
-
const i =
|
|
444
|
-
|
|
438
|
+
suggestValue(e) {
|
|
439
|
+
if (this._suggested = "", e) {
|
|
440
|
+
const { textField: t } = this.props, s = b(this.props), n = s[A(s, e, t)];
|
|
441
|
+
if (n) {
|
|
442
|
+
const i = y(n, t);
|
|
443
|
+
e.toLowerCase() !== i.toLowerCase() && (this._suggested = i.substring(e.length));
|
|
445
444
|
}
|
|
446
445
|
}
|
|
447
446
|
}
|
|
448
|
-
focusedIndex(
|
|
449
|
-
const { textField:
|
|
447
|
+
focusedIndex(e) {
|
|
448
|
+
const { textField: t, focusedItemIndex: s, skipDisabledItems: n } = this.props, i = b(this.props), a = e !== void 0 ? e : this.value;
|
|
450
449
|
if (this.state.focusedItem !== void 0)
|
|
451
|
-
return i.findIndex((
|
|
452
|
-
if (
|
|
453
|
-
return
|
|
454
|
-
const d = i.indexOf(
|
|
455
|
-
return
|
|
450
|
+
return i.findIndex((o) => S(o, this.state.focusedItem, t));
|
|
451
|
+
if (s)
|
|
452
|
+
return s(i, a, t);
|
|
453
|
+
const d = i.indexOf(M(i, a, t));
|
|
454
|
+
return n && t && d === -1 ? i.findIndex((o) => !o.disabled && o[t]) : Math.max(0, d);
|
|
456
455
|
}
|
|
457
|
-
calculateMedia(
|
|
458
|
-
for (const
|
|
459
|
-
this.setState({ windowWidth:
|
|
456
|
+
calculateMedia(e) {
|
|
457
|
+
for (const t of e)
|
|
458
|
+
this.setState({ windowWidth: t.target.clientWidth });
|
|
460
459
|
}
|
|
461
460
|
};
|
|
462
|
-
|
|
463
|
-
...
|
|
464
|
-
size:
|
|
465
|
-
rounded:
|
|
466
|
-
fillMode:
|
|
467
|
-
groupField:
|
|
468
|
-
suggest:
|
|
469
|
-
placeholder:
|
|
470
|
-
value:
|
|
471
|
-
defaultValue:
|
|
472
|
-
validationMessage:
|
|
473
|
-
required:
|
|
474
|
-
readonly:
|
|
475
|
-
clearButton:
|
|
476
|
-
valueRender:
|
|
477
|
-
id:
|
|
478
|
-
ariaLabelledBy:
|
|
479
|
-
ariaDescribedBy:
|
|
480
|
-
list:
|
|
481
|
-
adaptive:
|
|
482
|
-
adaptiveTitle:
|
|
483
|
-
onCancel:
|
|
484
|
-
skipDisabledItems:
|
|
485
|
-
inputAttributes:
|
|
486
|
-
},
|
|
487
|
-
...
|
|
461
|
+
I.displayName = "AutoComplete", I.propTypes = {
|
|
462
|
+
...C.basicPropTypes,
|
|
463
|
+
size: g.oneOf([null, "small", "medium", "large"]),
|
|
464
|
+
rounded: g.oneOf([null, "small", "medium", "large", "full"]),
|
|
465
|
+
fillMode: g.oneOf([null, "solid", "flat", "outline"]),
|
|
466
|
+
groupField: g.string,
|
|
467
|
+
suggest: g.oneOfType([g.bool, g.string]),
|
|
468
|
+
placeholder: g.string,
|
|
469
|
+
value: g.string,
|
|
470
|
+
defaultValue: g.string,
|
|
471
|
+
validationMessage: g.string,
|
|
472
|
+
required: g.bool,
|
|
473
|
+
readonly: g.bool,
|
|
474
|
+
clearButton: g.bool,
|
|
475
|
+
valueRender: g.func,
|
|
476
|
+
id: g.string,
|
|
477
|
+
ariaLabelledBy: g.string,
|
|
478
|
+
ariaDescribedBy: g.string,
|
|
479
|
+
list: g.any,
|
|
480
|
+
adaptive: g.bool,
|
|
481
|
+
adaptiveTitle: g.string,
|
|
482
|
+
onCancel: g.func,
|
|
483
|
+
skipDisabledItems: g.bool,
|
|
484
|
+
inputAttributes: g.object
|
|
485
|
+
}, I.defaultProps = {
|
|
486
|
+
...C.defaultProps,
|
|
488
487
|
size: "medium",
|
|
489
488
|
rounded: "medium",
|
|
490
489
|
fillMode: "solid",
|
|
@@ -492,16 +491,16 @@ y.displayName = "AutoComplete", y.propTypes = {
|
|
|
492
491
|
prefix: void 0,
|
|
493
492
|
suffix: void 0
|
|
494
493
|
};
|
|
495
|
-
let
|
|
496
|
-
const
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
494
|
+
let k = I;
|
|
495
|
+
const te = q(), se = W(
|
|
496
|
+
G(
|
|
497
|
+
te,
|
|
498
|
+
U(k)
|
|
500
499
|
)
|
|
501
500
|
);
|
|
502
|
-
|
|
501
|
+
se.displayName = "KendoReactAutoComplete";
|
|
503
502
|
export {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
503
|
+
se as AutoComplete,
|
|
504
|
+
te as AutoCompletePropsContext,
|
|
505
|
+
k as AutoCompleteWithoutContext
|
|
507
506
|
};
|