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