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