@progress/kendo-react-dropdowns 15.0.0 → 15.0.1-develop.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ComboBox/ComboBox.js +1 -1
- package/ComboBox/ComboBox.mjs +132 -132
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
package/ComboBox/ComboBox.mjs
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as c from "react";
|
|
9
|
-
import
|
|
9
|
+
import f from "prop-types";
|
|
10
10
|
import P from "../common/DropDownBase.mjs";
|
|
11
11
|
import { createPropsContext as it, classNames as S, uComboBox as F, Keys as x, validatePackage as ot, getLicenseMessage as at, svgIconPropType as nt, canUseDOM as H, subscribeToKendoPaste as lt, IconWrap as rt, WatermarkOverlay as pt, withIdHOC as dt, withPropsContext as ht, withUnstyledHOC as ct, withAdaptiveModeContext as ut } from "@progress/kendo-react-common";
|
|
12
12
|
import { FloatingLabel as gt } from "@progress/kendo-react-labels";
|
|
13
|
-
import { getPlainDataDuplicates as mt, getItemIndexByText as L, getFilteredData as I, areSame as w, getItemValue as
|
|
13
|
+
import { getPlainDataDuplicates as mt, getItemIndexByText as L, getFilteredData as I, areSame as w, getItemValue as k, isPresent as D, itemIndexStartsWith as N, suggestValue as ft } from "../common/utils.mjs";
|
|
14
14
|
import vt from "../common/SearchBar.mjs";
|
|
15
15
|
import bt from "../common/ListContainer.mjs";
|
|
16
16
|
import xt from "../common/List.mjs";
|
|
@@ -32,26 +32,26 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
32
32
|
}, this.checkForDuplicatePlainTextRecords = () => {
|
|
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
|
-
const
|
|
36
|
-
this.duplicates = mt(
|
|
35
|
+
const n = this.props.data;
|
|
36
|
+
this.duplicates = mt(n), this.hasDuplicates = this.duplicates.length > 0;
|
|
37
37
|
}
|
|
38
38
|
}, this.handleKendoPasteValue = (t) => {
|
|
39
|
-
const { data: e, textField:
|
|
39
|
+
const { data: e, textField: n, allowCustom: r } = this.props;
|
|
40
40
|
if (!e)
|
|
41
41
|
return;
|
|
42
|
-
const l = t != null ? String(t) : "", o = L(e, l,
|
|
43
|
-
let
|
|
44
|
-
if (p ?
|
|
42
|
+
const l = t != null ? String(t) : "", o = L(e, l, n, !1, !0), p = o !== -1;
|
|
43
|
+
let a = null;
|
|
44
|
+
if (p ? a = e[o] : r && (a = n ? { [n]: l } : l), a === null)
|
|
45
45
|
return;
|
|
46
46
|
const i = this.base.initState();
|
|
47
47
|
i.syntheticEvent = {
|
|
48
48
|
target: this._element,
|
|
49
49
|
currentTarget: this._element,
|
|
50
50
|
nativeEvent: new Event("change", { bubbles: !0 })
|
|
51
|
-
}, this.state.text !== void 0 && (i.data.text = void 0), this.triggerOnChange(
|
|
51
|
+
}, this.state.text !== void 0 && (i.data.text = void 0), this.triggerOnChange(a, i), this.applyState(i);
|
|
52
52
|
}, this.handleItemSelect = (t, e) => {
|
|
53
|
-
const { virtual:
|
|
54
|
-
this.triggerOnChange(p, e), this.state.text !== void 0 && (e.data.text = void 0),
|
|
53
|
+
const { virtual: n, dataItemKey: r } = this.props, l = I(this.props), o = n ? n.skip : 0, p = l[t - o], a = this.hasDuplicates || !w(p, this.value, r);
|
|
54
|
+
this.triggerOnChange(p, e), this.state.text !== void 0 && (e.data.text = void 0), a && this.base.triggerPageChangeCornerItems(p, e);
|
|
55
55
|
}, this.onPopupOpened = () => {
|
|
56
56
|
setTimeout(() => {
|
|
57
57
|
this.mobileMode && this._adaptiveFilterInput && (this._skipBlur = !0, this._adaptiveFilterInput.focus(), this._skipBlur = !1);
|
|
@@ -60,22 +60,22 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
60
60
|
this._element = t, this.base.wrapper = t;
|
|
61
61
|
}, this.toggleBtnClick = (t) => {
|
|
62
62
|
this._skipFocus = !0;
|
|
63
|
-
const { skipDisabledItems: e, textField:
|
|
64
|
-
if (
|
|
63
|
+
const { skipDisabledItems: e, textField: n } = this.props, r = I(this.props), l = this.getFocusedIndex(), o = this.getCurrentValueDisabledStatus(n, r, l), p = this.props.opened !== void 0 ? this.props.opened : this.state.opened, a = this.base.initState();
|
|
64
|
+
if (a.syntheticEvent = t, !e && n && o && this.clearValueOnToggleBtnClick(t), this.base.togglePopup(a), !p && this.mobileMode) {
|
|
65
65
|
const i = this.props.adaptiveFilter !== void 0 ? this.props.adaptiveFilter : this.state.text || null;
|
|
66
|
-
this.base.filterChanged(i,
|
|
66
|
+
this.base.filterChanged(i, a);
|
|
67
67
|
}
|
|
68
|
-
this.applyState(
|
|
68
|
+
this.applyState(a), setTimeout(() => {
|
|
69
69
|
this._skipFocus = !1;
|
|
70
70
|
}, 300);
|
|
71
71
|
}, this.closeOpenedApplyStateNonMobileMode = (t, e) => {
|
|
72
72
|
e && !this.mobileMode && this.base.togglePopup(t);
|
|
73
73
|
}, this.renderMobileListFilter = () => {
|
|
74
|
-
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 = k(this.value, this.props.textField), n = D(t) ? t : e;
|
|
75
75
|
return /* @__PURE__ */ c.createElement(
|
|
76
76
|
It,
|
|
77
77
|
{
|
|
78
|
-
value:
|
|
78
|
+
value: n,
|
|
79
79
|
ref: (r) => {
|
|
80
80
|
this._adaptiveFilterInput = r && r.element;
|
|
81
81
|
},
|
|
@@ -88,9 +88,9 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
88
88
|
}
|
|
89
89
|
);
|
|
90
90
|
}, this.listContainerContent = () => {
|
|
91
|
-
const { header: t, footer: e, size:
|
|
91
|
+
const { header: t, footer: e, size: n, groupStickyHeaderItemRender: r, groupField: l, list: o, unstyled: p, virtual: a } = this.props, i = I(this.props), d = p && p.uComboBox;
|
|
92
92
|
let { group: h } = this.state;
|
|
93
|
-
return h === void 0 && l !== void 0 && (h =
|
|
93
|
+
return h === void 0 && l !== void 0 && (h = k(i[0], l)), /* @__PURE__ */ c.createElement(
|
|
94
94
|
"div",
|
|
95
95
|
{
|
|
96
96
|
className: S(
|
|
@@ -98,8 +98,8 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
98
98
|
c: d,
|
|
99
99
|
list: o,
|
|
100
100
|
size: "large",
|
|
101
|
-
tableSize:
|
|
102
|
-
virtual:
|
|
101
|
+
tableSize: n,
|
|
102
|
+
virtual: a
|
|
103
103
|
})
|
|
104
104
|
)
|
|
105
105
|
},
|
|
@@ -118,17 +118,17 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
118
118
|
const e = this.base.initState();
|
|
119
119
|
e.syntheticEvent = t.syntheticEvent, e.data.text = t.target.value, this.base.filterChanged(t.target.value, e), this.applyState(e);
|
|
120
120
|
}, this.onScroll = (t) => {
|
|
121
|
-
const { vs: e, list:
|
|
121
|
+
const { vs: e, list: n } = this.base;
|
|
122
122
|
e.scrollHandler(t);
|
|
123
123
|
const { groupField: r } = this.props;
|
|
124
124
|
this.props.onListScroll && this.props.onListScroll(t);
|
|
125
125
|
let l = I(this.props);
|
|
126
126
|
if (!r || !l.length)
|
|
127
127
|
return;
|
|
128
|
-
const o = this.itemHeight = this.itemHeight || (e.enabled ? e.itemHeight :
|
|
128
|
+
const o = this.itemHeight = this.itemHeight || (e.enabled ? e.itemHeight : n ? n.children[0].offsetHeight : 0), a = t.target.scrollTop - e.skip * o;
|
|
129
129
|
l = this.base.getGroupedDataModernMode(l, r);
|
|
130
130
|
let i = l[0][r];
|
|
131
|
-
for (let d = 1; d < l.length && !(o * d >
|
|
131
|
+
for (let d = 1; d < l.length && !(o * d > a); d++)
|
|
132
132
|
l[d] && l[d][r] && (i = l[d][r]);
|
|
133
133
|
i !== this.state.group && (this.setState({
|
|
134
134
|
group: i
|
|
@@ -137,35 +137,35 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
137
137
|
this.navigationIndex = t, this.base.handleItemClick(t, e), this._valueDuringOnChange = void 0;
|
|
138
138
|
}, this.handleBlur = (t) => {
|
|
139
139
|
if (this.state.focused && !this._skipBlur) {
|
|
140
|
-
const e = this.base.initState(), { textField:
|
|
141
|
-
e.data.focused = !1, e.events.push({ type: "onBlur" }), e.syntheticEvent = t,
|
|
140
|
+
const e = this.base.initState(), { textField: n } = this.props, r = I(this.props), l = this.getFocusedIndex(), p = !(l === -1) && this.getCurrentValueDisabledStatus(n, r, l);
|
|
141
|
+
e.data.focused = !1, e.events.push({ type: "onBlur" }), e.syntheticEvent = t, n && p && this.clearValueOnBlur(t), this.applyValueOnRejectSuggestions(t.currentTarget.value, e);
|
|
142
142
|
}
|
|
143
143
|
}, this.onInputClick = (t) => {
|
|
144
|
-
const e = this.props.opened !== void 0 ? this.props.opened : this.state.opened,
|
|
144
|
+
const e = this.props.opened !== void 0 ? this.props.opened : this.state.opened, n = this.props.adaptiveFilter !== void 0 ? this.props.adaptiveFilter : this.state.text || null;
|
|
145
145
|
if (!e && this.mobileMode) {
|
|
146
146
|
const r = this.base.initState();
|
|
147
|
-
r.syntheticEvent = t, this.base.togglePopup(r), this.base.filterChanged(
|
|
147
|
+
r.syntheticEvent = t, this.base.togglePopup(r), this.base.filterChanged(n, r), this.applyState(r);
|
|
148
148
|
}
|
|
149
149
|
}, this.onInputKeyDown = (t) => {
|
|
150
|
-
const { skipDisabledItems: e, textField:
|
|
150
|
+
const { skipDisabledItems: e, textField: n, dataItemKey: r, groupField: l } = this.props, o = I(this.props), p = this.value, a = Math.max(
|
|
151
151
|
0,
|
|
152
152
|
o.findIndex((g) => w(g, p, r))
|
|
153
153
|
), i = t.keyCode, d = this.props.opened !== void 0 ? this.props.opened : this.state.opened, h = this.base.initState();
|
|
154
154
|
if (h.syntheticEvent = t, !t.altKey && (i === x.up || i === x.down)) {
|
|
155
|
-
if (t.preventDefault(), l !== "" &&
|
|
155
|
+
if (t.preventDefault(), l !== "" && n)
|
|
156
156
|
if (!this.props.skipDisabledItems && d)
|
|
157
157
|
this.onNavigate(h, i);
|
|
158
158
|
else {
|
|
159
159
|
let g = 0;
|
|
160
160
|
if (i === x.down || i === x.right) {
|
|
161
|
-
const u = o.slice(
|
|
161
|
+
const u = o.slice(a + 1 < o.length ? a + 1 : a).find((C) => !C.disabled);
|
|
162
162
|
g = u && o.indexOf(u);
|
|
163
163
|
} else if (i === x.up || i === x.left) {
|
|
164
164
|
let u;
|
|
165
|
-
if (
|
|
165
|
+
if (a === 0)
|
|
166
166
|
u = o, g = o.findIndex((C) => !C.disabled);
|
|
167
167
|
else {
|
|
168
|
-
u = o.slice(0,
|
|
168
|
+
u = o.slice(0, a);
|
|
169
169
|
let C = u.pop();
|
|
170
170
|
for (; C && C.disabled; )
|
|
171
171
|
C = u.pop();
|
|
@@ -173,45 +173,45 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
if (g !== void 0) {
|
|
176
|
-
const u = g -
|
|
176
|
+
const u = g - a;
|
|
177
177
|
this.onNavigate(h, i, u);
|
|
178
|
-
} else g === void 0 &&
|
|
178
|
+
} else g === void 0 && a === o.length - 1 && this.onNavigate(h, i);
|
|
179
179
|
}
|
|
180
180
|
else if (!this.props.skipDisabledItems && d)
|
|
181
181
|
this.onNavigate(h, i);
|
|
182
182
|
else {
|
|
183
183
|
let g = null;
|
|
184
184
|
if (i === x.down || i === x.right)
|
|
185
|
-
g = o.slice(
|
|
185
|
+
g = o.slice(a + 1).find((u) => !u.disabled);
|
|
186
186
|
else if (i === x.up || i === x.left) {
|
|
187
|
-
const u = o.slice(0,
|
|
187
|
+
const u = o.slice(0, a);
|
|
188
188
|
for (g = u.pop(); g && g.disabled; )
|
|
189
189
|
g = u.pop();
|
|
190
190
|
}
|
|
191
191
|
if (g) {
|
|
192
|
-
const u = g.id -
|
|
192
|
+
const u = g.id - a - 1;
|
|
193
193
|
this.onNavigate(h, i, u);
|
|
194
194
|
} else
|
|
195
195
|
this.onNavigate(h, i);
|
|
196
196
|
}
|
|
197
197
|
this.applyState(h);
|
|
198
198
|
}
|
|
199
|
-
const
|
|
199
|
+
const m = () => {
|
|
200
200
|
t.preventDefault(), this.base.togglePopup(h), this.applyState(h);
|
|
201
|
-
}, b = this.getFocusedIndex(), y = b === -1, v = !y && this.getCurrentValueDisabledStatus(
|
|
202
|
-
d ? i === x.pageUp ? (t.preventDefault(), this.base.scrollPopupByPageSize(-1)) : i === x.pageDown ? (t.preventDefault(), this.base.scrollPopupByPageSize(1)) : t.altKey && i === x.up ?
|
|
201
|
+
}, b = this.getFocusedIndex(), y = b === -1, v = !y && this.getCurrentValueDisabledStatus(n, o, b);
|
|
202
|
+
d ? i === x.pageUp ? (t.preventDefault(), this.base.scrollPopupByPageSize(-1)) : i === x.pageDown ? (t.preventDefault(), this.base.scrollPopupByPageSize(1)) : t.altKey && i === x.up ? m() : i === x.enter ? (t.preventDefault(), (n && !y && t.currentTarget.value ? o[b][n] : void 0) ? !e && n && v ? this.clearValueOnEnterOrEsc(t) : v || this.applyValueOnEnter(t.currentTarget.value, h) : this.applyValueOnEnter(t.currentTarget.value, h)) : i === x.esc && (!e && n && v && this.clearValueOnEnterOrEsc(t), this.applyValueOnRejectSuggestions(t.currentTarget.value, h)) : !d && i === x.esc ? this.clearValueOnEnterOrEsc(t) : t.altKey && i === x.down && m();
|
|
203
203
|
}, this.inputOnChange = (t) => {
|
|
204
204
|
const e = this.base.initState();
|
|
205
205
|
e.syntheticEvent = t;
|
|
206
|
-
const
|
|
206
|
+
const n = this.props.opened !== void 0 ? this.props.opened : this.state.opened, r = t.currentTarget, l = r.value;
|
|
207
207
|
if (this.props.suggest) {
|
|
208
208
|
const o = r.selectionEnd === l.length;
|
|
209
209
|
let p = this.props.filter !== void 0 ? this.props.filter : this.state.text;
|
|
210
|
-
|
|
211
|
-
const
|
|
212
|
-
|
|
210
|
+
D(p) || (p = k(this.value, this.props.textField) || "");
|
|
211
|
+
const a = p && p === l, i = p && p.length > l.length;
|
|
212
|
+
a || i || !o ? this._suggested = "" : this.suggestValue(l);
|
|
213
213
|
}
|
|
214
|
-
this.props.filter === void 0 && (e.data.text = l), this.state.focusedItem !== void 0 && (e.data.focusedItem = void 0),
|
|
214
|
+
this.props.filter === void 0 && (e.data.text = l), this.state.focusedItem !== void 0 && (e.data.focusedItem = void 0), n ? this.scrollToFocused = !0 : this.base.togglePopup(e), this.base.filterChanged(l, e), this.applyState(e), this.setState({ group: void 0 });
|
|
215
215
|
}, this.clearButtonClick = (t) => {
|
|
216
216
|
const e = this.base.initState();
|
|
217
217
|
e.syntheticEvent = t, t.stopPropagation(), this.clearValue();
|
|
@@ -273,7 +273,7 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
273
273
|
*/
|
|
274
274
|
get index() {
|
|
275
275
|
const { dataItemKey: s } = this.props, t = I(this.props), e = this.value;
|
|
276
|
-
return t.findIndex((
|
|
276
|
+
return t.findIndex((n) => w(n, e, s));
|
|
277
277
|
}
|
|
278
278
|
/**
|
|
279
279
|
* Gets the `name` property of the ComboBox.
|
|
@@ -301,18 +301,18 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
301
301
|
}
|
|
302
302
|
/** @hidden */
|
|
303
303
|
componentDidUpdate(s, t) {
|
|
304
|
-
var
|
|
305
|
-
const { dataItemKey: e, virtual:
|
|
304
|
+
var m, b;
|
|
305
|
+
const { dataItemKey: e, virtual: n, groupField: r = "", textField: l } = this.props, o = I(this.props), p = s.virtual ? s.virtual.total : 0, a = this.props.opened !== void 0 ? this.props.opened : this.state.opened, i = s.opened !== void 0 ? s.opened : t.opened;
|
|
306
306
|
s.data !== o && this.checkForDuplicatePlainTextRecords();
|
|
307
|
-
const d = !i &&
|
|
308
|
-
if (this._valueOnDidUpdate = h, this.base.didUpdate(),
|
|
307
|
+
const d = !i && a, h = this.value;
|
|
308
|
+
if (this._valueOnDidUpdate = h, this.base.didUpdate(), n && n.total !== p)
|
|
309
309
|
this.base.vs.calcScrollElementHeight(), this.base.vs.reset();
|
|
310
310
|
else {
|
|
311
311
|
const y = s.value !== void 0 ? s.value : t.value;
|
|
312
312
|
let v = this.hasDuplicates ? this.navigationIndex || 0 : o.findIndex((u) => w(u, h, e));
|
|
313
|
-
l && h && (v = (
|
|
313
|
+
l && h && (v = (m = this.base.getGroupedDataModernMode(o, r)) == null ? void 0 : m.map((u) => u[l]).indexOf(h[l]));
|
|
314
314
|
const g = !w(y, h, e);
|
|
315
|
-
if (d &&
|
|
315
|
+
if (d && n ? this.base.scrollToVirtualItem(n, v) : d && !n ? (this.onPopupOpened(), o && o.length !== 0 && this.base.resetGroupStickyHeader(o[0][r], this), this.base.scrollToItem(v)) : (this.hasDuplicates || a && i && h && g) && this.base.scrollToItem(v), a && i && this.scrollToFocused) {
|
|
316
316
|
const u = (b = this.props.filter ? this.props.filter : this.state.text) != null ? b : "";
|
|
317
317
|
if (u) {
|
|
318
318
|
const { focusedItemIndex: C = N } = this.props, M = C(o, u, l);
|
|
@@ -349,16 +349,16 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
349
349
|
U,
|
|
350
350
|
R[U]
|
|
351
351
|
), {
|
|
352
|
-
dir:
|
|
352
|
+
dir: n,
|
|
353
353
|
disabled: r,
|
|
354
354
|
clearButton: l = E.defaultProps.clearButton,
|
|
355
355
|
label: o,
|
|
356
356
|
textField: p,
|
|
357
|
-
className:
|
|
357
|
+
className: a,
|
|
358
358
|
style: i,
|
|
359
359
|
loading: d,
|
|
360
360
|
iconClassName: h,
|
|
361
|
-
virtual:
|
|
361
|
+
virtual: m,
|
|
362
362
|
size: b,
|
|
363
363
|
rounded: y,
|
|
364
364
|
fillMode: v,
|
|
@@ -366,8 +366,8 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
366
366
|
placeholder: u,
|
|
367
367
|
svgIcon: C,
|
|
368
368
|
unstyled: M
|
|
369
|
-
} = this.props, T = !this.validityStyles || this.validity.valid, O = this.props.filter !== void 0 ? this.props.filter : this.state.text, J =
|
|
370
|
-
V.enabled =
|
|
369
|
+
} = this.props, T = !this.validityStyles || this.validity.valid, O = this.props.filter !== void 0 ? this.props.filter : this.state.text, J = k(this.value, p), B = D(O) ? O : J, Q = l && (!!B || D(this.value)), V = this.base.vs, z = this.props.id || this._inputId, _ = M && M.uComboBox;
|
|
370
|
+
V.enabled = m !== void 0, m !== void 0 && (V.skip = m.skip, V.total = m.total, V.pageSize = m.pageSize);
|
|
371
371
|
const [X, Z] = Y(this.props.prefix || c.Fragment), [tt, et] = Y(this.props.suffix || c.Fragment), A = /* @__PURE__ */ c.createElement(c.Fragment, null, /* @__PURE__ */ c.createElement(
|
|
372
372
|
"span",
|
|
373
373
|
{
|
|
@@ -382,11 +382,11 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
382
382
|
loading: d,
|
|
383
383
|
required: this.required
|
|
384
384
|
}),
|
|
385
|
-
|
|
385
|
+
a
|
|
386
386
|
),
|
|
387
387
|
ref: this.componentRef,
|
|
388
388
|
style: o ? { ...i, width: void 0 } : i,
|
|
389
|
-
dir:
|
|
389
|
+
dir: n,
|
|
390
390
|
onFocus: this.handleFocus
|
|
391
391
|
},
|
|
392
392
|
this.props.prefix && /* @__PURE__ */ c.createElement(X, { ...Z }),
|
|
@@ -434,80 +434,80 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
434
434
|
}
|
|
435
435
|
/** @hidden */
|
|
436
436
|
onNavigate(s, t, e) {
|
|
437
|
-
const { virtual:
|
|
438
|
-
let
|
|
439
|
-
const
|
|
437
|
+
const { virtual: n = { skip: 0 }, textField: r } = this.props, l = I(this.props), o = this.props.filter ? this.props.filter : this.state.text;
|
|
438
|
+
let p = -1, a;
|
|
439
|
+
const i = this.base.vs, d = this.value;
|
|
440
440
|
this._suggested = "";
|
|
441
|
-
const
|
|
442
|
-
if (
|
|
443
|
-
this.handleItemSelect(
|
|
444
|
-
else if (
|
|
441
|
+
const h = this.hasDuplicates && this.duplicates.indexOf(d) !== -1;
|
|
442
|
+
if (p = this.getFocusedIndex(h), p !== -1 && (!D(d) || o && o !== k(d, r)))
|
|
443
|
+
this.handleItemSelect(p, s);
|
|
444
|
+
else if (o === "")
|
|
445
445
|
this.handleItemSelect(0, s);
|
|
446
446
|
else {
|
|
447
|
-
const
|
|
448
|
-
|
|
447
|
+
const m = n.skip + p;
|
|
448
|
+
a = this.base.navigation.navigate({
|
|
449
449
|
keyCode: t,
|
|
450
|
-
current:
|
|
451
|
-
max: (
|
|
450
|
+
current: m,
|
|
451
|
+
max: (i.enabled ? i.total : l.length) - 1,
|
|
452
452
|
min: 0,
|
|
453
453
|
skipItems: e || void 0
|
|
454
|
-
}),
|
|
454
|
+
}), a !== void 0 && this.handleItemSelect(a, s);
|
|
455
455
|
}
|
|
456
|
-
this.navigationIndex =
|
|
456
|
+
this.navigationIndex = a;
|
|
457
457
|
}
|
|
458
458
|
getCurrentValueDisabledStatus(s, t, e) {
|
|
459
459
|
return s && t && t[e] && t[e].disabled;
|
|
460
460
|
}
|
|
461
461
|
applyValueOnEnter(s, t) {
|
|
462
|
-
const { textField: e, allowCustom:
|
|
462
|
+
const { textField: e, allowCustom: n, ignoreCase: r } = this.props, l = I(this.props), o = this.props.opened !== void 0 ? this.props.opened : this.state.opened, a = k(this.value, e) === s ? this.index : L(l, s, e, !1, r), i = a !== -1;
|
|
463
463
|
let d;
|
|
464
464
|
if (this._suggested = "", i)
|
|
465
|
-
d = l[
|
|
466
|
-
else if (
|
|
465
|
+
d = l[a];
|
|
466
|
+
else if (n)
|
|
467
467
|
d = e !== void 0 ? { [e]: s } : s;
|
|
468
468
|
else
|
|
469
469
|
return this.selectFocusedItem(s, t);
|
|
470
470
|
this.triggerOnChange(d, t), o && this.base.togglePopup(t), this.props.filter === void 0 && this.state.text !== void 0 && (t.data.text = void 0), this.applyState(t);
|
|
471
471
|
}
|
|
472
472
|
applyValueOnRejectSuggestions(s, t) {
|
|
473
|
-
const { textField: e, allowCustom:
|
|
474
|
-
if (this._suggested = "", s === p || s === "" && !
|
|
473
|
+
const { textField: e, allowCustom: n, ignoreCase: r } = this.props, l = I(this.props), o = this.props.opened !== void 0 ? this.props.opened : this.state.opened, p = k(this.value, e);
|
|
474
|
+
if (this._suggested = "", s === p || s === "" && !D(p))
|
|
475
475
|
return this.closeOpenedApplyStateNonMobileMode(t, o), this.applyState(t);
|
|
476
|
-
const
|
|
476
|
+
const a = L(l, s, e, !0, r), i = a !== -1;
|
|
477
477
|
let d = null;
|
|
478
|
-
i ? d = l[
|
|
478
|
+
i ? d = l[a] : n && (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, o), this.applyState(t);
|
|
479
479
|
}
|
|
480
480
|
selectFocusedItem(s, t) {
|
|
481
|
-
const e = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { textField:
|
|
482
|
-
return
|
|
481
|
+
const e = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { textField: n, virtual: r = { skip: 0 }, focusedItemIndex: l = N } = this.props, o = I(this.props), p = r.skip, a = s === "" && p === 0 ? 0 : l(o, s, n);
|
|
482
|
+
return a !== -1 ? this.handleItemSelect(a + p, t) : (this.triggerOnChange(null, t), this.state.text !== void 0 && (t.data.text = void 0)), e && this.base.togglePopup(t), this.applyState(t);
|
|
483
483
|
}
|
|
484
484
|
renderAdaptiveListContainer() {
|
|
485
|
-
const { windowWidth: s = 0 } = this.state, { groupField: t, adaptiveTitle: e = this.props.label, adaptiveSubtitle:
|
|
485
|
+
const { windowWidth: s = 0 } = this.state, { groupField: t, adaptiveTitle: e = this.props.label, adaptiveSubtitle: n } = this.props, r = I(this.props), l = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
|
|
486
486
|
let { group: o } = this.state;
|
|
487
|
-
o === void 0 && t !== void 0 && (o =
|
|
487
|
+
o === void 0 && t !== void 0 && (o = k(r[0], t));
|
|
488
488
|
const p = {
|
|
489
489
|
title: e || this.props.label,
|
|
490
|
-
subTitle:
|
|
490
|
+
subTitle: n,
|
|
491
491
|
expand: l,
|
|
492
|
-
onClose: (
|
|
492
|
+
onClose: (a) => this.toggleBtnClick(a),
|
|
493
493
|
windowWidth: s,
|
|
494
494
|
mobileFilter: this.renderMobileListFilter()
|
|
495
495
|
};
|
|
496
496
|
return /* @__PURE__ */ c.createElement(kt, { ...p }, /* @__PURE__ */ c.createElement(Ft, null, /* @__PURE__ */ c.createElement("div", { className: "k-list-container" }, this.listContainerContent())));
|
|
497
497
|
}
|
|
498
498
|
renderListContainer() {
|
|
499
|
-
const s = this.base, { dir: t, header: e, footer:
|
|
499
|
+
const s = this.base, { dir: t, header: e, footer: n, groupField: r, size: l, list: o, virtual: p, groupStickyHeaderItemRender: a, unstyled: i } = this.props, d = I(this.props), h = this.props.opened !== void 0 ? this.props.opened : this.state.opened, m = s.getPopupSettings(), b = m.width !== void 0 ? m.width : s.popupWidth, y = i && i.uComboBox;
|
|
500
500
|
let { group: v } = this.state;
|
|
501
|
-
return v === void 0 && r !== void 0 && (v =
|
|
501
|
+
return v === void 0 && r !== void 0 && (v = k(d[0], r)), /* @__PURE__ */ c.createElement(
|
|
502
502
|
bt,
|
|
503
503
|
{
|
|
504
504
|
width: b,
|
|
505
505
|
popupSettings: {
|
|
506
|
-
...
|
|
507
|
-
anchor:
|
|
506
|
+
...m,
|
|
507
|
+
anchor: m.anchor || this.element,
|
|
508
508
|
show: h,
|
|
509
509
|
popupClass: S(
|
|
510
|
-
|
|
510
|
+
m.popupClass,
|
|
511
511
|
F.listContainer({
|
|
512
512
|
c: y,
|
|
513
513
|
popup: !0
|
|
@@ -531,9 +531,9 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
531
531
|
)
|
|
532
532
|
},
|
|
533
533
|
e && /* @__PURE__ */ c.createElement("div", { className: S(F.listHeader({ c: y })) }, e),
|
|
534
|
-
!o && v && d.length !== 0 && /* @__PURE__ */ c.createElement(q, { group: v, render:
|
|
534
|
+
!o && v && d.length !== 0 && /* @__PURE__ */ c.createElement(q, { group: v, render: a }),
|
|
535
535
|
this.renderList(),
|
|
536
|
-
|
|
536
|
+
n && /* @__PURE__ */ c.createElement(
|
|
537
537
|
"div",
|
|
538
538
|
{
|
|
539
539
|
className: S(
|
|
@@ -541,7 +541,7 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
541
541
|
this.props.footerClassName
|
|
542
542
|
)
|
|
543
543
|
},
|
|
544
|
-
|
|
544
|
+
n
|
|
545
545
|
)
|
|
546
546
|
),
|
|
547
547
|
this.showLicenseWatermark && /* @__PURE__ */ c.createElement(pt, { message: this.licenseMessage })
|
|
@@ -550,13 +550,13 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
550
550
|
renderList() {
|
|
551
551
|
const s = this.base, t = $(this), {
|
|
552
552
|
textField: e,
|
|
553
|
-
dataItemKey:
|
|
553
|
+
dataItemKey: n,
|
|
554
554
|
listNoDataRender: r,
|
|
555
555
|
itemRender: l,
|
|
556
556
|
groupHeaderItemRender: o,
|
|
557
557
|
virtual: p = { skip: 0, total: void 0 },
|
|
558
|
-
unstyled:
|
|
559
|
-
} = this.props, i = I(this.props), d = s.getPopupSettings(), h = s.vs,
|
|
558
|
+
unstyled: a
|
|
559
|
+
} = this.props, i = I(this.props), d = s.getPopupSettings(), h = s.vs, m = p.skip, b = this.props.opened !== void 0 ? this.props.opened : this.state.opened, y = `translateY(${h.translate}px)`, v = b ? this.getFocusedIndex(this.hasDuplicates) : void 0, g = this.props.filter !== void 0 ? this.props.filter : this.state.text, u = k(this.value, e), C = D(g) && g !== u ? null : this.value, M = this.props.list || xt, T = a && a.uComboBox;
|
|
560
560
|
return /* @__PURE__ */ c.createElement(
|
|
561
561
|
M,
|
|
562
562
|
{
|
|
@@ -567,7 +567,7 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
567
567
|
focusedIndex: v,
|
|
568
568
|
value: C,
|
|
569
569
|
textField: e,
|
|
570
|
-
valueField:
|
|
570
|
+
valueField: n,
|
|
571
571
|
groupField: this.props.groupField,
|
|
572
572
|
isMultiColumn: this.props.isMultiColumn,
|
|
573
573
|
optionsGuid: s.guid,
|
|
@@ -585,7 +585,7 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
585
585
|
),
|
|
586
586
|
listStyle: h.enabled ? { transform: y } : void 0,
|
|
587
587
|
key: "listkey",
|
|
588
|
-
skip:
|
|
588
|
+
skip: m,
|
|
589
589
|
onClick: this.handleItemClick,
|
|
590
590
|
itemRender: l,
|
|
591
591
|
groupHeaderItemRender: o,
|
|
@@ -600,16 +600,16 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
600
600
|
}
|
|
601
601
|
renderSearchBar(s, t, e) {
|
|
602
602
|
const {
|
|
603
|
-
tabIndex:
|
|
603
|
+
tabIndex: n,
|
|
604
604
|
accessKey: r,
|
|
605
605
|
disabled: l,
|
|
606
606
|
title: o,
|
|
607
607
|
ariaLabelledBy: p,
|
|
608
|
-
ariaDescribedBy:
|
|
608
|
+
ariaDescribedBy: a,
|
|
609
609
|
dataItemKey: i,
|
|
610
610
|
virtual: d = { skip: 0 },
|
|
611
611
|
unstyled: h,
|
|
612
|
-
inputAttributes:
|
|
612
|
+
inputAttributes: m
|
|
613
613
|
} = this.props;
|
|
614
614
|
I(this.props);
|
|
615
615
|
const b = this.props.opened !== void 0 ? this.props.opened : this.state.opened, y = b ? this.getFocusedIndex(this.hasDuplicates) : -1;
|
|
@@ -619,7 +619,7 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
619
619
|
id: t,
|
|
620
620
|
readOnly: b && this.mobileMode,
|
|
621
621
|
placeholder: e,
|
|
622
|
-
tabIndex:
|
|
622
|
+
tabIndex: n,
|
|
623
623
|
accessKey: r,
|
|
624
624
|
title: o,
|
|
625
625
|
value: s + this._suggested,
|
|
@@ -639,12 +639,12 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
639
639
|
role: "combobox",
|
|
640
640
|
ariaLabelledBy: p,
|
|
641
641
|
ariaLabel: this.props.ariaLabel,
|
|
642
|
-
ariaDescribedBy:
|
|
642
|
+
ariaDescribedBy: a,
|
|
643
643
|
ariaRequired: this.required,
|
|
644
644
|
render: this.props.valueRender,
|
|
645
645
|
ariaControls: b ? this.base.listBoxId : void 0,
|
|
646
646
|
unstyled: h,
|
|
647
|
-
inputAttributes:
|
|
647
|
+
inputAttributes: m
|
|
648
648
|
}
|
|
649
649
|
);
|
|
650
650
|
}
|
|
@@ -656,17 +656,17 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
656
656
|
}
|
|
657
657
|
triggerOnChange(s, t) {
|
|
658
658
|
const e = this.value;
|
|
659
|
-
!this.hasDuplicates && (!
|
|
659
|
+
!this.hasDuplicates && (!D(e) && !D(s) || w(e, s, this.props.dataItemKey)) || (this.props.value === void 0 && (t.data.value = s), this._valueDuringOnChange = s, t.events.push({ type: "onChange" }));
|
|
660
660
|
}
|
|
661
661
|
getFocusedIndex(s) {
|
|
662
662
|
const t = this.value, {
|
|
663
663
|
textField: e,
|
|
664
|
-
dataItemKey:
|
|
664
|
+
dataItemKey: n,
|
|
665
665
|
virtual: r = { skip: 0 },
|
|
666
666
|
focusedItemIndex: l = N,
|
|
667
667
|
skipDisabledItems: o
|
|
668
|
-
} = this.props, p = I(this.props),
|
|
669
|
-
return s && this.navigationIndex !== void 0 ? this.navigationIndex :
|
|
668
|
+
} = this.props, p = I(this.props), a = this.props.filter ? this.props.filter : this.state.text;
|
|
669
|
+
return s && this.navigationIndex !== void 0 ? this.navigationIndex : D(t) && a === void 0 ? p.findIndex((i) => w(i, t, n)) : a ? l(p, a, e) : o && e && !a && r.skip === 0 ? p.findIndex((i) => !i.disabled) : r.skip === 0 ? 0 : -1;
|
|
670
670
|
}
|
|
671
671
|
suggestValue(s) {
|
|
672
672
|
const { data: t, textField: e } = this.props;
|
|
@@ -682,30 +682,30 @@ const Dt = "Please enter a valid value!", E = class E extends c.Component {
|
|
|
682
682
|
};
|
|
683
683
|
E.displayName = "ComboBox", E.propTypes = {
|
|
684
684
|
...P.propTypes,
|
|
685
|
-
size:
|
|
686
|
-
rounded:
|
|
687
|
-
fillMode:
|
|
688
|
-
dataItemKey:
|
|
689
|
-
groupField:
|
|
690
|
-
isMultiColumn:
|
|
691
|
-
suggest:
|
|
692
|
-
placeholder:
|
|
693
|
-
title:
|
|
694
|
-
allowCustom:
|
|
695
|
-
ignoreCase:
|
|
696
|
-
clearButton:
|
|
697
|
-
iconClassName:
|
|
685
|
+
size: f.oneOf(["small", "medium", "large"]),
|
|
686
|
+
rounded: f.oneOf(["small", "medium", "large", "full", "none"]),
|
|
687
|
+
fillMode: f.oneOf(["solid", "flat", "outline"]),
|
|
688
|
+
dataItemKey: f.string,
|
|
689
|
+
groupField: f.string,
|
|
690
|
+
isMultiColumn: f.bool,
|
|
691
|
+
suggest: f.bool,
|
|
692
|
+
placeholder: f.string,
|
|
693
|
+
title: f.string,
|
|
694
|
+
allowCustom: f.bool,
|
|
695
|
+
ignoreCase: f.bool,
|
|
696
|
+
clearButton: f.bool,
|
|
697
|
+
iconClassName: f.string,
|
|
698
698
|
svgIcon: nt,
|
|
699
|
-
validationMessage:
|
|
700
|
-
required:
|
|
701
|
-
id:
|
|
702
|
-
ariaLabelledBy:
|
|
703
|
-
ariaLabel:
|
|
704
|
-
ariaDescribedBy:
|
|
705
|
-
list:
|
|
706
|
-
valueRender:
|
|
707
|
-
skipDisabledItems:
|
|
708
|
-
inputAttributes:
|
|
699
|
+
validationMessage: f.string,
|
|
700
|
+
required: f.bool,
|
|
701
|
+
id: f.string,
|
|
702
|
+
ariaLabelledBy: f.string,
|
|
703
|
+
ariaLabel: f.string,
|
|
704
|
+
ariaDescribedBy: f.string,
|
|
705
|
+
list: f.any,
|
|
706
|
+
valueRender: f.func,
|
|
707
|
+
skipDisabledItems: f.bool,
|
|
708
|
+
inputAttributes: f.object
|
|
709
709
|
}, E.defaultProps = {
|
|
710
710
|
...P.defaultProps,
|
|
711
711
|
size: void 0,
|