@progress/kendo-react-dropdowns 13.4.0-develop.4 → 13.4.0-develop.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AutoComplete/AutoComplete.d.ts +2 -0
- package/AutoComplete/AutoComplete.js +1 -1
- package/AutoComplete/AutoComplete.mjs +58 -43
- package/ComboBox/ComboBox.d.ts +2 -0
- package/ComboBox/ComboBox.js +1 -1
- package/ComboBox/ComboBox.mjs +165 -144
- package/DropDownList/DropDownList.js +1 -1
- package/DropDownList/DropDownList.mjs +295 -276
- package/MultiSelect/MultiSelect.d.ts +2 -0
- package/MultiSelect/MultiSelect.js +1 -1
- package/MultiSelect/MultiSelect.mjs +283 -261
- package/MultiSelect/TagList.js +1 -1
- package/MultiSelect/TagList.mjs +17 -17
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +1 -1
- package/package.json +10 -10
package/ComboBox/ComboBox.mjs
CHANGED
|
@@ -8,24 +8,24 @@
|
|
|
8
8
|
import * as u from "react";
|
|
9
9
|
import m from "prop-types";
|
|
10
10
|
import _ from "../common/DropDownBase.mjs";
|
|
11
|
-
import { withIdHOC as et, createPropsContext as st, withPropsContext as it, withUnstyledHOC as ot, withAdaptiveModeContext as at, classNames as S, uComboBox as F, Keys as I, validatePackage as nt, getLicenseMessage as lt, svgIconPropType as rt, canUseDOM as A,
|
|
12
|
-
import { FloatingLabel as
|
|
13
|
-
import { getPlainDataDuplicates as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
11
|
+
import { withIdHOC as et, createPropsContext as st, withPropsContext as it, withUnstyledHOC as ot, withAdaptiveModeContext as at, classNames as S, uComboBox as F, Keys as I, validatePackage as nt, getLicenseMessage as lt, svgIconPropType as rt, canUseDOM as A, subscribeToKendoPaste as pt, IconWrap as dt, WatermarkOverlay as ht } from "@progress/kendo-react-common";
|
|
12
|
+
import { FloatingLabel as ct } from "@progress/kendo-react-labels";
|
|
13
|
+
import { getPlainDataDuplicates as ut, getItemIndexByText as P, getFilteredData as y, areSame as w, getItemValue as D, isPresent as k, itemIndexStartsWith as L, suggestValue as gt } from "../common/utils.mjs";
|
|
14
|
+
import mt from "../common/SearchBar.mjs";
|
|
15
|
+
import ft from "../common/ListContainer.mjs";
|
|
16
|
+
import vt from "../common/List.mjs";
|
|
17
|
+
import bt from "../common/ListFilter.mjs";
|
|
18
|
+
import z from "../common/GroupStickyHeader.mjs";
|
|
19
19
|
import { packageMetadata as H } from "../package-metadata.mjs";
|
|
20
|
-
import
|
|
21
|
-
import { Button as
|
|
22
|
-
import { caretAltDownIcon as
|
|
20
|
+
import xt from "../common/ClearButton.mjs";
|
|
21
|
+
import { Button as It } from "@progress/kendo-react-buttons";
|
|
22
|
+
import { caretAltDownIcon as yt } from "@progress/kendo-svg-icons";
|
|
23
23
|
import { comboArrowBtnAriaLabelExpand as q, messages as W, comboArrowBtnAriaLabelCollapse as G } from "../messages/index.mjs";
|
|
24
24
|
import { provideLocalizationService as U } from "@progress/kendo-react-intl";
|
|
25
|
-
import { ActionSheetContent as
|
|
25
|
+
import { ActionSheetContent as Ct } from "@progress/kendo-react-layout";
|
|
26
26
|
import j from "../common/withCustomComponent.mjs";
|
|
27
|
-
import { AdaptiveMode as
|
|
28
|
-
const
|
|
27
|
+
import { AdaptiveMode as St } from "../common/AdaptiveMode.mjs";
|
|
28
|
+
const Ft = "Please enter a valid value!", M = class M extends u.Component {
|
|
29
29
|
constructor(s) {
|
|
30
30
|
super(s), this.state = {}, this.base = new _(this), this._element = null, this._suggested = "", this._skipBlur = !1, this._input = null, this._adaptiveFilterInput = null, this._skipFocus = !1, this.itemHeight = 0, this.duplicates = [], this.hasDuplicates = !1, this.scrollToFocused = !1, this.showLicenseWatermark = !1, this.focus = () => {
|
|
31
31
|
this._input && this._input.focus();
|
|
@@ -33,10 +33,24 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
33
33
|
const t = this.props.textField !== void 0, e = this.props.dataItemKey !== void 0;
|
|
34
34
|
if (this.props.data && this.props.data.length > 0 && !t && !e) {
|
|
35
35
|
const i = this.props.data;
|
|
36
|
-
this.duplicates =
|
|
36
|
+
this.duplicates = ut(i), this.hasDuplicates = this.duplicates.length > 0;
|
|
37
37
|
}
|
|
38
|
+
}, this.handleKendoPasteValue = (t) => {
|
|
39
|
+
const { data: e, textField: i, allowCustom: r } = this.props;
|
|
40
|
+
if (!e)
|
|
41
|
+
return;
|
|
42
|
+
const n = t != null ? String(t) : "", a = P(e, n, i, !1, !0), p = a !== -1;
|
|
43
|
+
let l = null;
|
|
44
|
+
if (p ? l = e[a] : r && (l = i ? { [i]: n } : n), l === null)
|
|
45
|
+
return;
|
|
46
|
+
const o = this.base.initState();
|
|
47
|
+
o.syntheticEvent = {
|
|
48
|
+
target: this._element,
|
|
49
|
+
currentTarget: this._element,
|
|
50
|
+
nativeEvent: new Event("change", { bubbles: !0 })
|
|
51
|
+
}, this.state.text !== void 0 && (o.data.text = void 0), this.triggerOnChange(l, o), this.applyState(o);
|
|
38
52
|
}, this.handleItemSelect = (t, e) => {
|
|
39
|
-
const { virtual: i, dataItemKey: r } = this.props, n = y(this.props),
|
|
53
|
+
const { virtual: i, dataItemKey: r } = this.props, n = y(this.props), a = i ? i.skip : 0, p = n[t - a], l = this.hasDuplicates || !w(p, this.value, r);
|
|
40
54
|
this.triggerOnChange(p, e), this.state.text !== void 0 && (e.data.text = void 0), l && this.base.triggerPageChangeCornerItems(p, e);
|
|
41
55
|
}, this.onPopupOpened = () => {
|
|
42
56
|
setTimeout(() => {
|
|
@@ -46,10 +60,10 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
46
60
|
this._element = t, this.base.wrapper = t;
|
|
47
61
|
}, this.toggleBtnClick = (t) => {
|
|
48
62
|
this._skipFocus = !0;
|
|
49
|
-
const { skipDisabledItems: e, textField: i } = this.props, r = y(this.props), n = this.getFocusedIndex(),
|
|
50
|
-
if (l.syntheticEvent = t, !e && i &&
|
|
51
|
-
const
|
|
52
|
-
this.base.filterChanged(
|
|
63
|
+
const { skipDisabledItems: e, textField: i } = this.props, r = y(this.props), n = this.getFocusedIndex(), a = this.getCurrentValueDisabledStatus(i, r, n), p = this.props.opened !== void 0 ? this.props.opened : this.state.opened, l = this.base.initState();
|
|
64
|
+
if (l.syntheticEvent = t, !e && i && a && this.clearValueOnToggleBtnClick(t), this.base.togglePopup(l), !p && this.mobileMode) {
|
|
65
|
+
const o = this.props.adaptiveFilter !== void 0 ? this.props.adaptiveFilter : this.state.text || null;
|
|
66
|
+
this.base.filterChanged(o, l);
|
|
53
67
|
}
|
|
54
68
|
this.applyState(l), setTimeout(() => {
|
|
55
69
|
this._skipFocus = !1;
|
|
@@ -57,9 +71,9 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
57
71
|
}, this.closeOpenedApplyStateNonMobileMode = (t, e) => {
|
|
58
72
|
e && !this.mobileMode && this.base.togglePopup(t);
|
|
59
73
|
}, this.renderMobileListFilter = () => {
|
|
60
|
-
const t = this.props.adaptiveFilter !== void 0 ? this.props.adaptiveFilter : this.state.text, e =
|
|
74
|
+
const t = this.props.adaptiveFilter !== void 0 ? this.props.adaptiveFilter : this.state.text, e = D(this.value, this.props.textField), i = k(t) ? t : e;
|
|
61
75
|
return /* @__PURE__ */ u.createElement(
|
|
62
|
-
|
|
76
|
+
bt,
|
|
63
77
|
{
|
|
64
78
|
value: i,
|
|
65
79
|
ref: (r) => {
|
|
@@ -74,15 +88,15 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
74
88
|
}
|
|
75
89
|
);
|
|
76
90
|
}, this.listContainerContent = () => {
|
|
77
|
-
const { header: t, footer: e, size: i, groupStickyHeaderItemRender: r, groupField: n, list:
|
|
91
|
+
const { header: t, footer: e, size: i, groupStickyHeaderItemRender: r, groupField: n, list: a, unstyled: p, virtual: l } = this.props, o = y(this.props), d = p && p.uComboBox;
|
|
78
92
|
let { group: h } = this.state;
|
|
79
|
-
return h === void 0 && n !== void 0 && (h =
|
|
93
|
+
return h === void 0 && n !== void 0 && (h = D(o[0], n)), /* @__PURE__ */ u.createElement(
|
|
80
94
|
"div",
|
|
81
95
|
{
|
|
82
96
|
className: S(
|
|
83
97
|
F.list({
|
|
84
98
|
c: d,
|
|
85
|
-
list:
|
|
99
|
+
list: a,
|
|
86
100
|
size: "large",
|
|
87
101
|
tableSize: i,
|
|
88
102
|
virtual: l
|
|
@@ -90,7 +104,7 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
90
104
|
)
|
|
91
105
|
},
|
|
92
106
|
t && /* @__PURE__ */ u.createElement("div", { className: S(F.listHeader({ c: d })) }, t),
|
|
93
|
-
!
|
|
107
|
+
!a && h && o.length !== 0 && /* @__PURE__ */ u.createElement(z, { group: h, render: r }),
|
|
94
108
|
this.renderList(),
|
|
95
109
|
e && /* @__PURE__ */ u.createElement(
|
|
96
110
|
"div",
|
|
@@ -110,14 +124,14 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
110
124
|
let n = y(this.props);
|
|
111
125
|
if (!r || !n.length)
|
|
112
126
|
return;
|
|
113
|
-
const
|
|
127
|
+
const a = this.itemHeight = this.itemHeight || (e.enabled ? e.itemHeight : i ? i.children[0].offsetHeight : 0), l = t.target.scrollTop - e.skip * a;
|
|
114
128
|
n = this.base.getGroupedDataModernMode(n, r);
|
|
115
|
-
let
|
|
116
|
-
for (let d = 1; d < n.length && !(
|
|
117
|
-
n[d] && n[d][r] && (
|
|
118
|
-
|
|
119
|
-
group:
|
|
120
|
-
}), this.props.onGroupScroll && this.props.onGroupScroll.call(void 0, { group:
|
|
129
|
+
let o = n[0][r];
|
|
130
|
+
for (let d = 1; d < n.length && !(a * d > l); d++)
|
|
131
|
+
n[d] && n[d][r] && (o = n[d][r]);
|
|
132
|
+
o !== this.state.group && (this.setState({
|
|
133
|
+
group: o
|
|
134
|
+
}), this.props.onGroupScroll && this.props.onGroupScroll.call(void 0, { group: o }));
|
|
121
135
|
}, this.handleItemClick = (t, e) => {
|
|
122
136
|
this.navigationIndex = t, this.base.handleItemClick(t, e), this._valueDuringOnChange = void 0;
|
|
123
137
|
}, this.handleBlur = (t) => {
|
|
@@ -132,69 +146,69 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
132
146
|
r.syntheticEvent = t, this.base.togglePopup(r), this.base.filterChanged(i, r), this.applyState(r);
|
|
133
147
|
}
|
|
134
148
|
}, this.onInputKeyDown = (t) => {
|
|
135
|
-
const { skipDisabledItems: e, textField: i, dataItemKey: r, groupField: n } = this.props,
|
|
149
|
+
const { skipDisabledItems: e, textField: i, dataItemKey: r, groupField: n } = this.props, a = y(this.props), p = this.value, l = Math.max(
|
|
136
150
|
0,
|
|
137
|
-
|
|
138
|
-
),
|
|
139
|
-
if (h.syntheticEvent = t, !t.altKey && (
|
|
151
|
+
a.findIndex((g) => w(g, p, r))
|
|
152
|
+
), o = t.keyCode, d = this.props.opened !== void 0 ? this.props.opened : this.state.opened, h = this.base.initState();
|
|
153
|
+
if (h.syntheticEvent = t, !t.altKey && (o === I.up || o === I.down)) {
|
|
140
154
|
if (t.preventDefault(), n !== "" && i)
|
|
141
155
|
if (!this.props.skipDisabledItems && d)
|
|
142
|
-
this.onNavigate(h,
|
|
156
|
+
this.onNavigate(h, o);
|
|
143
157
|
else {
|
|
144
158
|
let g = 0;
|
|
145
|
-
if (
|
|
146
|
-
const c =
|
|
147
|
-
g = c &&
|
|
148
|
-
} else if (
|
|
159
|
+
if (o === I.down || o === I.right) {
|
|
160
|
+
const c = a.slice(l + 1 < a.length ? l + 1 : l).find((v) => !v.disabled && v[i]);
|
|
161
|
+
g = c && a.findIndex((v) => v[i] === c[i]);
|
|
162
|
+
} else if (o === I.up || o === I.left) {
|
|
149
163
|
let c;
|
|
150
164
|
if (l === 0)
|
|
151
|
-
c =
|
|
165
|
+
c = a, g = a.findIndex((v) => !v.disabled && v[i]);
|
|
152
166
|
else {
|
|
153
|
-
c =
|
|
167
|
+
c = a.slice(0, l);
|
|
154
168
|
let v = c.pop();
|
|
155
169
|
for (; v && v.disabled; )
|
|
156
170
|
v = c.pop();
|
|
157
|
-
g = v &&
|
|
171
|
+
g = v && a.findIndex((E) => E[i] === v[i]);
|
|
158
172
|
}
|
|
159
173
|
}
|
|
160
174
|
if (g !== void 0) {
|
|
161
175
|
const c = g - l;
|
|
162
|
-
this.onNavigate(h,
|
|
163
|
-
} else g === void 0 &&
|
|
176
|
+
this.onNavigate(h, o, c);
|
|
177
|
+
} else g === void 0 && a.findIndex((c) => c[i] === p[i]) === a.length - 1 && this.onNavigate(h, o);
|
|
164
178
|
}
|
|
165
179
|
else if (!this.props.skipDisabledItems && d)
|
|
166
|
-
this.onNavigate(h,
|
|
180
|
+
this.onNavigate(h, o);
|
|
167
181
|
else {
|
|
168
182
|
let g = null;
|
|
169
|
-
if (
|
|
170
|
-
g =
|
|
171
|
-
else if (
|
|
172
|
-
const c =
|
|
183
|
+
if (o === I.down || o === I.right)
|
|
184
|
+
g = a.slice(l + 1).find((c) => !c.disabled);
|
|
185
|
+
else if (o === I.up || o === I.left) {
|
|
186
|
+
const c = a.slice(0, l);
|
|
173
187
|
for (g = c.pop(); g && g.disabled; )
|
|
174
188
|
g = c.pop();
|
|
175
189
|
}
|
|
176
190
|
if (g) {
|
|
177
191
|
const c = g.id - l - 1;
|
|
178
|
-
this.onNavigate(h,
|
|
192
|
+
this.onNavigate(h, o, c);
|
|
179
193
|
} else
|
|
180
|
-
this.onNavigate(h,
|
|
194
|
+
this.onNavigate(h, o);
|
|
181
195
|
}
|
|
182
196
|
this.applyState(h);
|
|
183
197
|
}
|
|
184
198
|
const b = () => {
|
|
185
199
|
t.preventDefault(), this.base.togglePopup(h), this.applyState(h);
|
|
186
|
-
}, C = this.getFocusedIndex(), x = C === -1, f = !x && this.getCurrentValueDisabledStatus(i,
|
|
187
|
-
d ?
|
|
200
|
+
}, C = this.getFocusedIndex(), x = C === -1, f = !x && this.getCurrentValueDisabledStatus(i, a, C);
|
|
201
|
+
d ? o === I.pageUp ? (t.preventDefault(), this.base.scrollPopupByPageSize(-1)) : o === I.pageDown ? (t.preventDefault(), this.base.scrollPopupByPageSize(1)) : t.altKey && o === I.up ? b() : o === I.enter ? (t.preventDefault(), (i && !x && t.currentTarget.value ? a[C][i] : void 0) ? !e && i && f ? this.clearValueOnEnterOrEsc(t) : f || this.applyValueOnEnter(t.currentTarget.value, h) : this.applyValueOnEnter(t.currentTarget.value, h)) : o === I.esc && (!e && i && f && this.clearValueOnEnterOrEsc(t), this.applyValueOnRejectSuggestions(t.currentTarget.value, h)) : !d && o === I.esc ? this.clearValueOnEnterOrEsc(t) : t.altKey && o === I.down && b();
|
|
188
202
|
}, this.inputOnChange = (t) => {
|
|
189
203
|
const e = this.base.initState();
|
|
190
204
|
e.syntheticEvent = t;
|
|
191
205
|
const i = this.props.opened !== void 0 ? this.props.opened : this.state.opened, r = t.currentTarget, n = r.value;
|
|
192
206
|
if (this.props.suggest) {
|
|
193
|
-
const
|
|
207
|
+
const a = r.selectionEnd === n.length;
|
|
194
208
|
let p = this.props.filter !== void 0 ? this.props.filter : this.state.text;
|
|
195
|
-
k(p) || (p =
|
|
196
|
-
const l = p && p === n,
|
|
197
|
-
l ||
|
|
209
|
+
k(p) || (p = D(this.value, this.props.textField) || "");
|
|
210
|
+
const l = p && p === n, o = p && p.length > n.length;
|
|
211
|
+
l || o || !a ? this._suggested = "" : this.suggestValue(n);
|
|
198
212
|
}
|
|
199
213
|
this.props.filter === void 0 && (e.data.text = n), this.state.focusedItem !== void 0 && (e.data.focusedItem = void 0), i ? this.scrollToFocused = !0 : this.base.togglePopup(e), this.base.filterChanged(n, e), this.applyState(e), this.setState({ group: void 0 });
|
|
200
214
|
}, this.clearButtonClick = (t) => {
|
|
@@ -211,7 +225,7 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
211
225
|
e.syntheticEvent = t, t.stopPropagation(), this.clearValue();
|
|
212
226
|
}, this.setValidity = () => {
|
|
213
227
|
this._input && this._input.setCustomValidity && this._input.setCustomValidity(
|
|
214
|
-
this.validity.valid ? "" : this.props.validationMessage ||
|
|
228
|
+
this.validity.valid ? "" : this.props.validationMessage || Ft
|
|
215
229
|
);
|
|
216
230
|
}, this.handleFocus = (t) => {
|
|
217
231
|
if (this._skipFocus)
|
|
@@ -258,7 +272,7 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
258
272
|
*/
|
|
259
273
|
get index() {
|
|
260
274
|
const { dataItemKey: s } = this.props, t = y(this.props), e = this.value;
|
|
261
|
-
return t.findIndex((i) =>
|
|
275
|
+
return t.findIndex((i) => w(i, e, s));
|
|
262
276
|
}
|
|
263
277
|
/**
|
|
264
278
|
* Gets the `name` property of the ComboBox.
|
|
@@ -287,20 +301,20 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
287
301
|
/** @hidden */
|
|
288
302
|
componentDidUpdate(s, t) {
|
|
289
303
|
var b, C;
|
|
290
|
-
const { dataItemKey: e, virtual: i, groupField: r = "", textField: n } = this.props,
|
|
291
|
-
s.data !==
|
|
292
|
-
const d = !
|
|
304
|
+
const { dataItemKey: e, virtual: i, groupField: r = "", textField: n } = this.props, a = y(this.props), p = s.virtual ? s.virtual.total : 0, l = this.props.opened !== void 0 ? this.props.opened : this.state.opened, o = s.opened !== void 0 ? s.opened : t.opened;
|
|
305
|
+
s.data !== a && this.checkForDuplicatePlainTextRecords();
|
|
306
|
+
const d = !o && l, h = this.value;
|
|
293
307
|
if (this._valueOnDidUpdate = h, this.base.didUpdate(), i && i.total !== p)
|
|
294
308
|
this.base.vs.calcScrollElementHeight(), this.base.vs.reset();
|
|
295
309
|
else {
|
|
296
310
|
const x = s.value !== void 0 ? s.value : t.value;
|
|
297
|
-
let f = this.hasDuplicates ? this.navigationIndex || 0 :
|
|
298
|
-
n && h && (f = (b = this.base.getGroupedDataModernMode(
|
|
299
|
-
const g = !
|
|
300
|
-
if (d && i ? this.base.scrollToVirtualItem(i, f) : d && !i ? (this.onPopupOpened(),
|
|
311
|
+
let f = this.hasDuplicates ? this.navigationIndex || 0 : a.findIndex((c) => w(c, h, e));
|
|
312
|
+
n && h && (f = (b = this.base.getGroupedDataModernMode(a, r)) == null ? void 0 : b.map((c) => c[n]).indexOf(h[n]));
|
|
313
|
+
const g = !w(x, h, e);
|
|
314
|
+
if (d && i ? this.base.scrollToVirtualItem(i, f) : d && !i ? (this.onPopupOpened(), a && a.length !== 0 && this.base.resetGroupStickyHeader(a[0][r], this), this.base.scrollToItem(f)) : (this.hasDuplicates || l && o && h && g) && this.base.scrollToItem(f), l && o && this.scrollToFocused) {
|
|
301
315
|
const c = (C = this.props.filter ? this.props.filter : this.state.text) != null ? C : "";
|
|
302
316
|
if (c) {
|
|
303
|
-
const { focusedItemIndex: v =
|
|
317
|
+
const { focusedItemIndex: v = L } = this.props, E = v(a, c, n);
|
|
304
318
|
this.base.scrollToItem(E);
|
|
305
319
|
} else
|
|
306
320
|
this.base.scrollToItem(0);
|
|
@@ -310,13 +324,20 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
310
324
|
}
|
|
311
325
|
/** @hidden */
|
|
312
326
|
componentDidMount() {
|
|
313
|
-
var
|
|
314
|
-
this.observerResize = A && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this)), this.base.didMount(), this.setValidity(), (
|
|
327
|
+
var t;
|
|
328
|
+
this.observerResize = A && 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), this.checkForDuplicatePlainTextRecords();
|
|
329
|
+
const s = this.props.name || this.props.id;
|
|
330
|
+
this.KendoPasteSubscription = pt(this._element, {
|
|
331
|
+
fieldName: s,
|
|
332
|
+
onValueChange: (e) => {
|
|
333
|
+
this.handleKendoPasteValue(e);
|
|
334
|
+
}
|
|
335
|
+
});
|
|
315
336
|
}
|
|
316
337
|
/** @hidden */
|
|
317
338
|
componentWillUnmount() {
|
|
318
|
-
var s;
|
|
319
|
-
(s = this.document) != null && s.body && this.observerResize && this.observerResize.disconnect();
|
|
339
|
+
var s, t;
|
|
340
|
+
(s = this.document) != null && s.body && this.observerResize && this.observerResize.disconnect(), (t = this.KendoPasteSubscription) == null || t.unsubscribe();
|
|
320
341
|
}
|
|
321
342
|
/** @hidden */
|
|
322
343
|
render() {
|
|
@@ -331,10 +352,10 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
331
352
|
disabled: i,
|
|
332
353
|
clearButton: r = M.defaultProps.clearButton,
|
|
333
354
|
label: n,
|
|
334
|
-
textField:
|
|
355
|
+
textField: a,
|
|
335
356
|
className: p,
|
|
336
357
|
style: l,
|
|
337
|
-
loading:
|
|
358
|
+
loading: o,
|
|
338
359
|
iconClassName: d,
|
|
339
360
|
virtual: h,
|
|
340
361
|
size: b,
|
|
@@ -344,20 +365,20 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
344
365
|
placeholder: g,
|
|
345
366
|
svgIcon: c,
|
|
346
367
|
unstyled: v
|
|
347
|
-
} = this.props, E = !this.validityStyles || this.validity.valid,
|
|
368
|
+
} = this.props, E = !this.validityStyles || this.validity.valid, T = this.props.filter !== void 0 ? this.props.filter : this.state.text, $ = D(this.value, a), V = k(T) ? T : $, Y = r && (!!V || k(this.value)), O = this.base.vs, R = this.props.id || this._inputId, B = v && v.uComboBox;
|
|
348
369
|
O.enabled = h !== void 0, h !== void 0 && (O.skip = h.skip, O.total = h.total, O.pageSize = h.pageSize);
|
|
349
|
-
const [J, Q] = j(this.props.prefix || u.Fragment), [X, Z] = j(this.props.suffix || u.Fragment),
|
|
370
|
+
const [J, Q] = j(this.props.prefix || u.Fragment), [X, Z] = j(this.props.suffix || u.Fragment), K = /* @__PURE__ */ u.createElement(u.Fragment, null, /* @__PURE__ */ u.createElement(
|
|
350
371
|
"span",
|
|
351
372
|
{
|
|
352
373
|
className: S(
|
|
353
374
|
F.wrapper({
|
|
354
|
-
c:
|
|
375
|
+
c: B,
|
|
355
376
|
size: b,
|
|
356
377
|
rounded: C,
|
|
357
378
|
fillMode: x,
|
|
358
379
|
disabled: i,
|
|
359
380
|
invalid: !E,
|
|
360
|
-
loading:
|
|
381
|
+
loading: o,
|
|
361
382
|
required: this.required
|
|
362
383
|
}),
|
|
363
384
|
p
|
|
@@ -368,29 +389,29 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
368
389
|
onFocus: this.handleFocus
|
|
369
390
|
},
|
|
370
391
|
this.props.prefix && /* @__PURE__ */ u.createElement(J, { ...Q }),
|
|
371
|
-
this.renderSearchBar(
|
|
372
|
-
Y && !
|
|
373
|
-
|
|
374
|
-
|
|
392
|
+
this.renderSearchBar(V || "", R, g),
|
|
393
|
+
Y && !o && /* @__PURE__ */ u.createElement(xt, { onClick: this.clearButtonClick, key: "clearbutton" }),
|
|
394
|
+
o && /* @__PURE__ */ u.createElement(
|
|
395
|
+
dt,
|
|
375
396
|
{
|
|
376
|
-
className: S(F.loadingIcon({ c:
|
|
397
|
+
className: S(F.loadingIcon({ c: B })),
|
|
377
398
|
name: "loading",
|
|
378
399
|
key: "loading"
|
|
379
400
|
}
|
|
380
401
|
),
|
|
381
402
|
this.props.suffix && /* @__PURE__ */ u.createElement(X, { ...Z }),
|
|
382
403
|
/* @__PURE__ */ u.createElement(
|
|
383
|
-
|
|
404
|
+
It,
|
|
384
405
|
{
|
|
385
406
|
tabIndex: -1,
|
|
386
407
|
type: "button",
|
|
387
408
|
"aria-label": f ? t : s,
|
|
388
409
|
icon: d ? void 0 : "caret-alt-down",
|
|
389
|
-
svgIcon: c ||
|
|
410
|
+
svgIcon: c || yt,
|
|
390
411
|
iconClass: d,
|
|
391
412
|
size: b,
|
|
392
413
|
fillMode: x,
|
|
393
|
-
className: S(F.inputButton({ c:
|
|
414
|
+
className: S(F.inputButton({ c: B })),
|
|
394
415
|
onClick: this.toggleBtnClick,
|
|
395
416
|
onMouseDown: (tt) => tt.preventDefault()
|
|
396
417
|
}
|
|
@@ -398,32 +419,32 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
398
419
|
!this.mobileMode && this.renderListContainer()
|
|
399
420
|
), this.mobileMode && this.renderAdaptiveListContainer());
|
|
400
421
|
return n ? /* @__PURE__ */ u.createElement(
|
|
401
|
-
|
|
422
|
+
ct,
|
|
402
423
|
{
|
|
403
424
|
label: n,
|
|
404
|
-
editorId:
|
|
405
|
-
editorValue:
|
|
425
|
+
editorId: R,
|
|
426
|
+
editorValue: V,
|
|
406
427
|
editorValid: E,
|
|
407
428
|
editorDisabled: i,
|
|
408
429
|
style: { width: l ? l.width : void 0 },
|
|
409
|
-
children:
|
|
430
|
+
children: K,
|
|
410
431
|
unstyled: v
|
|
411
432
|
}
|
|
412
|
-
) :
|
|
433
|
+
) : K;
|
|
413
434
|
}
|
|
414
435
|
/** @hidden */
|
|
415
436
|
onNavigate(s, t, e) {
|
|
416
437
|
const { virtual: i = { skip: 0 } } = this.props, r = y(this.props), n = this.props.filter ? this.props.filter : this.state.text;
|
|
417
|
-
let
|
|
418
|
-
const l = this.base.vs,
|
|
438
|
+
let a = -1, p;
|
|
439
|
+
const l = this.base.vs, o = this.value;
|
|
419
440
|
this._suggested = "";
|
|
420
|
-
const d = this.hasDuplicates && this.duplicates.indexOf(
|
|
421
|
-
if (
|
|
422
|
-
this.handleItemSelect(
|
|
441
|
+
const d = this.hasDuplicates && this.duplicates.indexOf(o) !== -1;
|
|
442
|
+
if (a = this.getFocusedIndex(d), a !== -1 && !k(o))
|
|
443
|
+
this.handleItemSelect(a, s);
|
|
423
444
|
else if (n === "")
|
|
424
445
|
this.handleItemSelect(0, s);
|
|
425
446
|
else {
|
|
426
|
-
const h = i.skip +
|
|
447
|
+
const h = i.skip + a;
|
|
427
448
|
p = this.base.navigation.navigate({
|
|
428
449
|
keyCode: t,
|
|
429
450
|
current: h,
|
|
@@ -438,32 +459,32 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
438
459
|
return s && t && t[e] && t[e].disabled;
|
|
439
460
|
}
|
|
440
461
|
applyValueOnEnter(s, t) {
|
|
441
|
-
const { textField: e, allowCustom: i, ignoreCase: r } = this.props, n = y(this.props),
|
|
462
|
+
const { textField: e, allowCustom: i, ignoreCase: r } = this.props, n = y(this.props), a = this.props.opened !== void 0 ? this.props.opened : this.state.opened, l = D(this.value, e) === s ? this.index : P(n, s, e, !1, r), o = l !== -1;
|
|
442
463
|
let d;
|
|
443
|
-
if (this._suggested = "",
|
|
464
|
+
if (this._suggested = "", o)
|
|
444
465
|
d = n[l];
|
|
445
466
|
else if (i)
|
|
446
467
|
d = e !== void 0 ? { [e]: s } : s;
|
|
447
468
|
else
|
|
448
469
|
return this.selectFocusedItem(s, t);
|
|
449
|
-
this.triggerOnChange(d, t),
|
|
470
|
+
this.triggerOnChange(d, t), a && this.base.togglePopup(t), this.props.filter === void 0 && this.state.text !== void 0 && (t.data.text = void 0), this.applyState(t);
|
|
450
471
|
}
|
|
451
472
|
applyValueOnRejectSuggestions(s, t) {
|
|
452
|
-
const { textField: e, allowCustom: i, ignoreCase: r } = this.props, n = y(this.props),
|
|
473
|
+
const { textField: e, allowCustom: i, ignoreCase: r } = this.props, n = y(this.props), a = this.props.opened !== void 0 ? this.props.opened : this.state.opened, p = D(this.value, e);
|
|
453
474
|
if (this._suggested = "", s === p || s === "" && !k(p))
|
|
454
|
-
return this.closeOpenedApplyStateNonMobileMode(t,
|
|
455
|
-
const l =
|
|
475
|
+
return this.closeOpenedApplyStateNonMobileMode(t, a), this.applyState(t);
|
|
476
|
+
const l = P(n, s, e, !0, r), o = l !== -1;
|
|
456
477
|
let d = null;
|
|
457
|
-
|
|
478
|
+
o ? d = n[l] : i && (d = s ? e ? { [e]: s } : s : null), this.triggerOnChange(d, t), this.state.text !== void 0 && (t.data.text = void 0, this.base.filterChanged("", t)), this.closeOpenedApplyStateNonMobileMode(t, a), this.applyState(t);
|
|
458
479
|
}
|
|
459
480
|
selectFocusedItem(s, t) {
|
|
460
|
-
const e = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { textField: i, virtual: r = { skip: 0 }, focusedItemIndex: n =
|
|
481
|
+
const e = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { textField: i, virtual: r = { skip: 0 }, focusedItemIndex: n = L } = this.props, a = y(this.props), p = r.skip, l = s === "" && p === 0 ? 0 : n(a, s, i);
|
|
461
482
|
return l !== -1 ? this.handleItemSelect(l + p, t) : (this.triggerOnChange(null, t), this.state.text !== void 0 && (t.data.text = void 0)), e && this.base.togglePopup(t), this.applyState(t);
|
|
462
483
|
}
|
|
463
484
|
renderAdaptiveListContainer() {
|
|
464
485
|
const { windowWidth: s = 0 } = this.state, { groupField: t, adaptiveTitle: e = this.props.label, adaptiveSubtitle: i } = this.props, r = y(this.props), n = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
|
|
465
|
-
let { group:
|
|
466
|
-
|
|
486
|
+
let { group: a } = this.state;
|
|
487
|
+
a === void 0 && t !== void 0 && (a = D(r[0], t));
|
|
467
488
|
const p = {
|
|
468
489
|
title: e || this.props.label,
|
|
469
490
|
subTitle: i,
|
|
@@ -472,13 +493,13 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
472
493
|
windowWidth: s,
|
|
473
494
|
mobileFilter: this.renderMobileListFilter()
|
|
474
495
|
};
|
|
475
|
-
return /* @__PURE__ */ u.createElement(
|
|
496
|
+
return /* @__PURE__ */ u.createElement(St, { ...p }, /* @__PURE__ */ u.createElement(Ct, null, /* @__PURE__ */ u.createElement("div", { className: "k-list-container" }, this.listContainerContent())));
|
|
476
497
|
}
|
|
477
498
|
renderListContainer() {
|
|
478
|
-
const s = this.base, { dir: t, header: e, footer: i, groupField: r, size: n, list:
|
|
499
|
+
const s = this.base, { dir: t, header: e, footer: i, groupField: r, size: n, list: a, virtual: p, groupStickyHeaderItemRender: l, unstyled: o } = this.props, d = y(this.props), h = this.props.opened !== void 0 ? this.props.opened : this.state.opened, b = s.getPopupSettings(), C = b.width !== void 0 ? b.width : s.popupWidth, x = o && o.uComboBox;
|
|
479
500
|
let { group: f } = this.state;
|
|
480
|
-
return f === void 0 && r !== void 0 && (f =
|
|
481
|
-
|
|
501
|
+
return f === void 0 && r !== void 0 && (f = D(d[0], r)), /* @__PURE__ */ u.createElement(
|
|
502
|
+
ft,
|
|
482
503
|
{
|
|
483
504
|
width: C,
|
|
484
505
|
popupSettings: {
|
|
@@ -502,7 +523,7 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
502
523
|
className: S(
|
|
503
524
|
F.list({
|
|
504
525
|
c: x,
|
|
505
|
-
list:
|
|
526
|
+
list: a,
|
|
506
527
|
size: n,
|
|
507
528
|
tableSize: n,
|
|
508
529
|
virtual: p
|
|
@@ -510,7 +531,7 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
510
531
|
)
|
|
511
532
|
},
|
|
512
533
|
e && /* @__PURE__ */ u.createElement("div", { className: S(F.listHeader({ c: x })) }, e),
|
|
513
|
-
!
|
|
534
|
+
!a && f && d.length !== 0 && /* @__PURE__ */ u.createElement(z, { group: f, render: l }),
|
|
514
535
|
this.renderList(),
|
|
515
536
|
i && /* @__PURE__ */ u.createElement(
|
|
516
537
|
"div",
|
|
@@ -523,7 +544,7 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
523
544
|
i
|
|
524
545
|
)
|
|
525
546
|
),
|
|
526
|
-
this.showLicenseWatermark && /* @__PURE__ */ u.createElement(
|
|
547
|
+
this.showLicenseWatermark && /* @__PURE__ */ u.createElement(ht, { message: this.licenseMessage })
|
|
527
548
|
);
|
|
528
549
|
}
|
|
529
550
|
renderList() {
|
|
@@ -533,14 +554,14 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
533
554
|
listNoDataRender: i,
|
|
534
555
|
itemRender: r,
|
|
535
556
|
groupHeaderItemRender: n,
|
|
536
|
-
virtual:
|
|
557
|
+
virtual: a = { skip: 0, total: void 0 },
|
|
537
558
|
unstyled: p
|
|
538
|
-
} = this.props, l = y(this.props),
|
|
559
|
+
} = this.props, l = y(this.props), o = s.getPopupSettings(), d = s.vs, h = a.skip, b = this.props.opened !== void 0 ? this.props.opened : this.state.opened, C = `translateY(${d.translate}px)`, x = b ? this.getFocusedIndex(this.hasDuplicates) : void 0, f = this.props.filter !== void 0 ? this.props.filter : this.state.text, g = D(this.value, t), c = k(f) && f !== g ? null : this.value, v = this.props.list || vt, E = p && p.uComboBox;
|
|
539
560
|
return /* @__PURE__ */ u.createElement(
|
|
540
561
|
v,
|
|
541
562
|
{
|
|
542
563
|
id: s.listBoxId,
|
|
543
|
-
virtual: !!
|
|
564
|
+
virtual: !!a,
|
|
544
565
|
show: b,
|
|
545
566
|
data: l,
|
|
546
567
|
focusedIndex: x,
|
|
@@ -551,14 +572,14 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
551
572
|
isMultiColumn: this.props.isMultiColumn,
|
|
552
573
|
optionsGuid: s.guid,
|
|
553
574
|
hasDuplicates: this.hasDuplicates,
|
|
554
|
-
listRef: (
|
|
555
|
-
d.list = this.base.list =
|
|
575
|
+
listRef: (T) => {
|
|
576
|
+
d.list = this.base.list = T, this.itemHeight = 0;
|
|
556
577
|
},
|
|
557
|
-
wrapperStyle: this.mobileMode ? {} : { maxHeight:
|
|
578
|
+
wrapperStyle: this.mobileMode ? {} : { maxHeight: o.height },
|
|
558
579
|
wrapperCssClass: S(
|
|
559
580
|
F.listContent({
|
|
560
581
|
c: E,
|
|
561
|
-
virtual:
|
|
582
|
+
virtual: a
|
|
562
583
|
})
|
|
563
584
|
),
|
|
564
585
|
listStyle: d.enabled ? { transform: C } : void 0,
|
|
@@ -568,11 +589,11 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
568
589
|
itemRender: r,
|
|
569
590
|
groupHeaderItemRender: n,
|
|
570
591
|
noDataRender: i,
|
|
571
|
-
onMouseDown: (
|
|
592
|
+
onMouseDown: (T) => T.preventDefault(),
|
|
572
593
|
onScroll: this.onScroll,
|
|
573
594
|
wrapperRef: d.scrollerRef,
|
|
574
595
|
scroller: this.base.renderScrollElement(),
|
|
575
|
-
ariaSetSize:
|
|
596
|
+
ariaSetSize: a.total
|
|
576
597
|
}
|
|
577
598
|
);
|
|
578
599
|
}
|
|
@@ -581,26 +602,26 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
581
602
|
tabIndex: i,
|
|
582
603
|
accessKey: r,
|
|
583
604
|
disabled: n,
|
|
584
|
-
title:
|
|
605
|
+
title: a,
|
|
585
606
|
ariaLabelledBy: p,
|
|
586
607
|
ariaDescribedBy: l,
|
|
587
|
-
dataItemKey:
|
|
608
|
+
dataItemKey: o,
|
|
588
609
|
virtual: d = { skip: 0 },
|
|
589
610
|
unstyled: h,
|
|
590
611
|
inputAttributes: b
|
|
591
612
|
} = this.props, C = y(this.props), x = this.props.opened !== void 0 ? this.props.opened : this.state.opened, f = this.value, g = Math.max(
|
|
592
613
|
0,
|
|
593
|
-
C.findIndex((c) =>
|
|
614
|
+
C.findIndex((c) => w(c, f, o))
|
|
594
615
|
);
|
|
595
|
-
return this._suggested && !
|
|
596
|
-
|
|
616
|
+
return this._suggested && !w(this._valueOnDidUpdate, f, o) && (this._suggested = ""), /* @__PURE__ */ u.createElement(
|
|
617
|
+
mt,
|
|
597
618
|
{
|
|
598
619
|
id: t,
|
|
599
620
|
readOnly: x && this.mobileMode,
|
|
600
621
|
placeholder: e,
|
|
601
622
|
tabIndex: i,
|
|
602
623
|
accessKey: r,
|
|
603
|
-
title:
|
|
624
|
+
title: a,
|
|
604
625
|
value: s + this._suggested,
|
|
605
626
|
suggestedText: this._suggested,
|
|
606
627
|
ref: (c) => {
|
|
@@ -635,21 +656,21 @@ const St = "Please enter a valid value!", M = class M extends u.Component {
|
|
|
635
656
|
}
|
|
636
657
|
triggerOnChange(s, t) {
|
|
637
658
|
const e = this.value;
|
|
638
|
-
!this.hasDuplicates && (!k(e) && !k(s) ||
|
|
659
|
+
!this.hasDuplicates && (!k(e) && !k(s) || w(e, s, this.props.dataItemKey)) || (this.props.value === void 0 && (t.data.value = s), this._valueDuringOnChange = s, t.events.push({ type: "onChange" }));
|
|
639
660
|
}
|
|
640
661
|
getFocusedIndex(s) {
|
|
641
662
|
const t = this.value, {
|
|
642
663
|
textField: e,
|
|
643
664
|
dataItemKey: i,
|
|
644
665
|
virtual: r = { skip: 0 },
|
|
645
|
-
focusedItemIndex: n =
|
|
646
|
-
skipDisabledItems:
|
|
666
|
+
focusedItemIndex: n = L,
|
|
667
|
+
skipDisabledItems: a
|
|
647
668
|
} = this.props, p = y(this.props), l = this.props.filter ? this.props.filter : this.state.text;
|
|
648
|
-
return s && this.navigationIndex !== void 0 ? this.navigationIndex : k(t) && l === void 0 ? p.findIndex((
|
|
669
|
+
return s && this.navigationIndex !== void 0 ? this.navigationIndex : k(t) && l === void 0 ? p.findIndex((o) => w(o, t, i)) : l ? n(p, l, e) : a && e && !l && r.skip === 0 ? p.findIndex((o) => !o.disabled && o[e]) : r.skip === 0 ? 0 : -1;
|
|
649
670
|
}
|
|
650
671
|
suggestValue(s) {
|
|
651
672
|
const { data: t, textField: e } = this.props;
|
|
652
|
-
this._suggested =
|
|
673
|
+
this._suggested = gt(s, t, e);
|
|
653
674
|
}
|
|
654
675
|
applyState(s) {
|
|
655
676
|
this.base.applyState(s), this._valueDuringOnChange = void 0;
|
|
@@ -699,18 +720,18 @@ M.displayName = "ComboBox", M.propTypes = {
|
|
|
699
720
|
prefix: void 0,
|
|
700
721
|
suffix: void 0
|
|
701
722
|
};
|
|
702
|
-
let
|
|
703
|
-
const
|
|
723
|
+
let N = M;
|
|
724
|
+
const kt = st(), wt = et(
|
|
704
725
|
it(
|
|
705
|
-
|
|
726
|
+
kt,
|
|
706
727
|
ot(
|
|
707
|
-
at(
|
|
728
|
+
at(N)
|
|
708
729
|
)
|
|
709
730
|
)
|
|
710
731
|
);
|
|
711
|
-
|
|
732
|
+
wt.displayName = "KendoReactComboBox";
|
|
712
733
|
export {
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
734
|
+
wt as ComboBox,
|
|
735
|
+
kt as ComboBoxPropsContext,
|
|
736
|
+
N as ComboBoxWithoutContext
|
|
716
737
|
};
|