@progress/kendo-react-dropdowns 8.2.0 → 8.2.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/AutoComplete/AutoComplete.js +1 -1
- package/AutoComplete/AutoComplete.mjs +206 -208
- package/DropDownList/DropDownList.js +1 -1
- package/DropDownList/DropDownList.mjs +222 -227
- package/MultiSelect/MultiSelect.js +1 -1
- package/MultiSelect/MultiSelect.mjs +329 -330
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/index.d.mts +9 -2
- package/index.d.ts +9 -2
- package/package-metadata.mjs +1 -1
- package/package.json +9 -9
|
@@ -8,29 +8,29 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
import * as h from "react";
|
|
10
10
|
import S from "prop-types";
|
|
11
|
-
import { classNames as
|
|
12
|
-
import { FloatingLabel as
|
|
13
|
-
import { caretAltDownIcon as
|
|
11
|
+
import { classNames as L, Keys as v, validatePackage as Q, svgIconPropType as X, canUseDOM as H, getTabIndex as Z, IconWrap as ee, createPropsContext as te, withIdHOC as se, withPropsContext as ie, kendoThemeMaps as ae } from "@progress/kendo-react-common";
|
|
12
|
+
import { FloatingLabel as oe } from "@progress/kendo-react-labels";
|
|
13
|
+
import { caretAltDownIcon as ne, xIcon as re } from "@progress/kendo-svg-icons";
|
|
14
14
|
import le from "../common/ListContainer.mjs";
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import { areSame as
|
|
21
|
-
import { packageMetadata as
|
|
22
|
-
import { Button as
|
|
23
|
-
import { provideLocalizationService as
|
|
24
|
-
import { dropDownListArrowBtnAriaLabel as
|
|
25
|
-
import { MOBILE_MEDIUM_DEVISE as
|
|
26
|
-
import { ActionSheet as
|
|
27
|
-
const
|
|
15
|
+
import de from "../common/ListFilter.mjs";
|
|
16
|
+
import B from "../common/GroupStickyHeader.mjs";
|
|
17
|
+
import pe from "../common/ListDefaultItem.mjs";
|
|
18
|
+
import he from "../common/List.mjs";
|
|
19
|
+
import z from "../common/DropDownBase.mjs";
|
|
20
|
+
import { getFilteredData as x, areSame as E, getItemValue as K, sameCharsOnly as ce, shuffleData as ue, matchText as W, isPresent as q, itemIndexStartsWith as me } from "../common/utils.mjs";
|
|
21
|
+
import { packageMetadata as fe } from "../package-metadata.mjs";
|
|
22
|
+
import { Button as U } from "@progress/kendo-react-buttons";
|
|
23
|
+
import { provideLocalizationService as ge } from "@progress/kendo-react-intl";
|
|
24
|
+
import { dropDownListArrowBtnAriaLabel as G, messages as ve } from "../messages/index.mjs";
|
|
25
|
+
import { MOBILE_MEDIUM_DEVISE as $, MOBILE_SMALL_DEVISE as Y } from "../common/constants.mjs";
|
|
26
|
+
import { ActionSheet as be, ActionSheetHeader as Ie, ActionSheetContent as ye } from "@progress/kendo-react-layout";
|
|
27
|
+
const ke = "Please select a value from the list!", { sizeMap: T, roundedMap: Se } = ae, _ = class _ extends h.Component {
|
|
28
28
|
constructor(s) {
|
|
29
|
-
super(s), this.state = {}, this._element = null, this.base = new
|
|
29
|
+
super(s), this.state = {}, this._element = null, this.base = new z(this), this.searchState = { word: "", last: "" }, this._select = null, this._skipFocusEvent = !1, this._filterInput = null, this._navigated = !1, this._lastKeypressIsFilter = !1, this.itemHeight = 0, this.focus = () => {
|
|
30
30
|
this.base.wrapper && this.base.wrapper.focus({ preventScroll: !0 });
|
|
31
31
|
}, this.handleItemSelect = (e, t) => {
|
|
32
|
-
const {
|
|
33
|
-
this.triggerOnChange(
|
|
32
|
+
const { virtual: a, dataItemKey: p, defaultItem: n } = this.props, o = x(this.props), f = a ? a.skip : 0, l = e === -1 && n !== void 0 ? n : o[e - f], i = !E(l, this.value, p);
|
|
33
|
+
this.triggerOnChange(l, t), i && this.base.triggerPageChangeCornerItems(l, t);
|
|
34
34
|
}, this.componentRef = (e) => {
|
|
35
35
|
this._element = e, this.base.wrapper = e;
|
|
36
36
|
}, this.dummySelect = (e) => /* @__PURE__ */ h.createElement(
|
|
@@ -52,97 +52,96 @@ const ye = "Please select a value from the list!", { sizeMap: z, roundedMap: ke
|
|
|
52
52
|
}
|
|
53
53
|
)
|
|
54
54
|
), this.renderListContainer = () => {
|
|
55
|
-
const { header: e, footer: t, dir: a,
|
|
56
|
-
dir: a !== void 0 ? a :
|
|
55
|
+
const { header: e, footer: t, dir: a, size: p, groupField: n, groupStickyHeaderItemRender: o, list: f } = this.props, l = x(this.props), i = this.base, c = i.getPopupSettings(), r = this.props.opened !== void 0 ? this.props.opened : this.state.opened, b = c.width !== void 0 ? c.width : i.popupWidth, I = {
|
|
56
|
+
dir: a !== void 0 ? a : i.dirCalculated,
|
|
57
57
|
width: b,
|
|
58
58
|
popupSettings: {
|
|
59
|
-
...
|
|
60
|
-
popupClass:
|
|
61
|
-
|
|
59
|
+
...c,
|
|
60
|
+
popupClass: L(
|
|
61
|
+
c.popupClass,
|
|
62
62
|
"k-list-container",
|
|
63
63
|
"k-dropdownlist-popup"
|
|
64
64
|
),
|
|
65
|
-
anchor:
|
|
66
|
-
show:
|
|
65
|
+
anchor: c.anchor || this.element,
|
|
66
|
+
show: r,
|
|
67
67
|
onOpen: this.onPopupOpened,
|
|
68
68
|
onClose: this.onPopupClosed
|
|
69
69
|
},
|
|
70
|
-
itemsCount: [
|
|
70
|
+
itemsCount: [l.length]
|
|
71
71
|
};
|
|
72
72
|
let { group: m } = this.state;
|
|
73
|
-
return m === void 0 && n !== void 0 && (m =
|
|
73
|
+
return m === void 0 && n !== void 0 && (m = K(l[0], n)), /* @__PURE__ */ h.createElement(le, { ...I }, this.renderListFilter(), e && /* @__PURE__ */ h.createElement("div", { className: "k-list-header" }, e), /* @__PURE__ */ h.createElement(
|
|
74
74
|
"div",
|
|
75
75
|
{
|
|
76
|
-
className:
|
|
76
|
+
className: L(
|
|
77
77
|
"k-list",
|
|
78
78
|
{
|
|
79
|
-
[`k-list-${
|
|
79
|
+
[`k-list-${T[p] || p}`]: p,
|
|
80
80
|
"k-virtual-list": this.base.vs.enabled
|
|
81
81
|
}
|
|
82
82
|
)
|
|
83
83
|
},
|
|
84
84
|
this.renderDefaultItem(),
|
|
85
|
-
!
|
|
85
|
+
!f && m && l.length !== 0 && /* @__PURE__ */ h.createElement(B, { group: m, groupMode: "modern", render: o }),
|
|
86
86
|
this.renderList()
|
|
87
87
|
), t && /* @__PURE__ */ h.createElement("div", { className: "k-list-footer" }, t));
|
|
88
88
|
}, this.renderList = () => {
|
|
89
89
|
const {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
groupHeaderItemRender: o,
|
|
90
|
+
textField: e,
|
|
91
|
+
dataItemKey: t,
|
|
92
|
+
virtual: a = { skip: 0, total: void 0 },
|
|
93
|
+
groupHeaderItemRender: p,
|
|
95
94
|
listNoDataRender: n,
|
|
96
|
-
itemRender:
|
|
97
|
-
} = this.props,
|
|
95
|
+
itemRender: o
|
|
96
|
+
} = this.props, f = x(this.props), l = this.base.vs, i = a.skip, c = this.props.opened !== void 0 ? this.props.opened : this.state.opened, r = this.base.getPopupSettings(), b = `translateY(${l.translate}px)`;
|
|
98
97
|
return /* @__PURE__ */ h.createElement(
|
|
99
|
-
|
|
98
|
+
he,
|
|
100
99
|
{
|
|
101
100
|
id: this._listboxId,
|
|
102
|
-
show:
|
|
103
|
-
data:
|
|
101
|
+
show: c,
|
|
102
|
+
data: f.slice(),
|
|
104
103
|
focusedIndex: this.getFocusedIndex(),
|
|
105
104
|
value: this.value,
|
|
106
|
-
textField:
|
|
107
|
-
valueField:
|
|
105
|
+
textField: e,
|
|
106
|
+
valueField: t,
|
|
108
107
|
optionsGuid: this._guid,
|
|
109
108
|
groupField: this.props.groupField,
|
|
110
109
|
groupMode: "modern",
|
|
111
|
-
listRef: (I) =>
|
|
112
|
-
wrapperStyle: { maxHeight:
|
|
110
|
+
listRef: (I) => l.list = this.base.list = I,
|
|
111
|
+
wrapperStyle: { maxHeight: r.height },
|
|
113
112
|
wrapperCssClass: "k-list-content",
|
|
114
|
-
listStyle:
|
|
113
|
+
listStyle: l.enabled ? { transform: b } : void 0,
|
|
115
114
|
key: "listkey",
|
|
116
|
-
skip:
|
|
115
|
+
skip: i,
|
|
117
116
|
onClick: this.handleItemClick,
|
|
118
|
-
itemRender:
|
|
119
|
-
groupHeaderItemRender:
|
|
117
|
+
itemRender: o,
|
|
118
|
+
groupHeaderItemRender: p,
|
|
120
119
|
noDataRender: n,
|
|
121
120
|
onScroll: this.onScroll,
|
|
122
|
-
wrapperRef:
|
|
121
|
+
wrapperRef: l.scrollerRef,
|
|
123
122
|
scroller: this.base.renderScrollElement(),
|
|
124
|
-
ariaSetSize:
|
|
123
|
+
ariaSetSize: a.total
|
|
125
124
|
}
|
|
126
125
|
);
|
|
127
126
|
}, this.onScroll = (e) => {
|
|
128
127
|
const { vs: t, list: a } = this.base;
|
|
129
128
|
t.scrollHandler(e);
|
|
130
|
-
const { groupField:
|
|
131
|
-
let
|
|
132
|
-
if (!(!
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
let
|
|
136
|
-
for (let
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
group:
|
|
129
|
+
const { groupField: p } = this.props;
|
|
130
|
+
let n = x(this.props);
|
|
131
|
+
if (!(!p || !n.length) && p) {
|
|
132
|
+
const o = this.itemHeight = this.itemHeight || (t.enabled ? t.itemHeight : a ? a.children[0].offsetHeight : 0), l = e.target.scrollTop - t.skip * o;
|
|
133
|
+
n = this.base.getGroupedDataModernMode(n, p);
|
|
134
|
+
let i = n[0][p];
|
|
135
|
+
for (let c = 1; c < n.length && !(o * c > l); c++)
|
|
136
|
+
n[c] && n[c][p] && (i = n[c][p]);
|
|
137
|
+
i !== this.state.group && this.setState({
|
|
138
|
+
group: i
|
|
140
139
|
});
|
|
141
140
|
}
|
|
142
141
|
}, this.renderListFilter = () => {
|
|
143
142
|
const e = this.props.filter !== void 0 ? this.props.filter : this.state.text;
|
|
144
143
|
return this.props.filterable && /* @__PURE__ */ h.createElement(
|
|
145
|
-
|
|
144
|
+
de,
|
|
146
145
|
{
|
|
147
146
|
value: e,
|
|
148
147
|
ref: (t) => this._filterInput = t && t.element,
|
|
@@ -157,11 +156,11 @@ const ye = "Please select a value from the list!", { sizeMap: z, roundedMap: ke
|
|
|
157
156
|
}, this.renderDefaultItem = () => {
|
|
158
157
|
const { textField: e, defaultItem: t, dataItemKey: a } = this.props;
|
|
159
158
|
return t !== void 0 && /* @__PURE__ */ h.createElement(
|
|
160
|
-
|
|
159
|
+
pe,
|
|
161
160
|
{
|
|
162
161
|
defaultItem: t,
|
|
163
162
|
textField: e,
|
|
164
|
-
selected:
|
|
163
|
+
selected: E(this.value, t, a),
|
|
165
164
|
key: "defaultitemkey",
|
|
166
165
|
onClick: this.handleDefaultItemClick
|
|
167
166
|
}
|
|
@@ -169,105 +168,104 @@ const ye = "Please select a value from the list!", { sizeMap: z, roundedMap: ke
|
|
|
169
168
|
}, this.search = (e) => {
|
|
170
169
|
clearTimeout(this._typingTimeout), this.props.filterable || (this._typingTimeout = window.setTimeout(() => this.searchState.word = "", this.props.delay), this.selectNext(e));
|
|
171
170
|
}, this.selectNext = (e) => {
|
|
172
|
-
const {
|
|
173
|
-
let
|
|
174
|
-
const
|
|
175
|
-
let
|
|
176
|
-
this.props.defaultItem && (
|
|
177
|
-
let
|
|
178
|
-
const { textField:
|
|
179
|
-
for (; m <
|
|
180
|
-
if (
|
|
181
|
-
m =
|
|
171
|
+
const { dataItemKey: t } = this.props, a = x(this.props);
|
|
172
|
+
let p = a.map((C, N) => ({ item: C, itemIndex: N }));
|
|
173
|
+
const n = this.searchState.word, o = this.searchState.last, f = ce(n, o);
|
|
174
|
+
let l = p.length, i = Math.max(0, a.findIndex((C) => E(C, this.value, t))), c;
|
|
175
|
+
this.props.defaultItem && (c = { item: this.props.defaultItem, itemIndex: -1 }, l += 1, i += 1), i += f ? 1 : 0, p = ue(p, i, c);
|
|
176
|
+
let r, b, I, m = 0;
|
|
177
|
+
const { textField: d, ignoreCase: w } = this.props;
|
|
178
|
+
for (; m < l; m++)
|
|
179
|
+
if (r = K(p[m].item, d), b = f && W(r, o, w), I = W(r, n, w), b || I) {
|
|
180
|
+
m = p[m].itemIndex;
|
|
182
181
|
break;
|
|
183
182
|
}
|
|
184
|
-
if (m !==
|
|
185
|
-
const
|
|
186
|
-
|
|
183
|
+
if (m !== l) {
|
|
184
|
+
const C = this.base.initState();
|
|
185
|
+
C.syntheticEvent = e, this.handleItemSelect(m, C), this.applyState(C), this._valueDuringOnChange = void 0;
|
|
187
186
|
}
|
|
188
187
|
}, this.handleKeyDown = (e) => {
|
|
189
188
|
e && e.target instanceof Element && e.target.nodeName === "INPUT" && e.stopPropagation && e.stopPropagation();
|
|
190
189
|
const {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
defaultItem: o,
|
|
190
|
+
filterable: t,
|
|
191
|
+
disabled: a,
|
|
192
|
+
defaultItem: p,
|
|
195
193
|
leftRightKeysNavigation: n = !0,
|
|
196
|
-
virtual:
|
|
197
|
-
dataItemKey:
|
|
198
|
-
groupField:
|
|
194
|
+
virtual: o = { skip: 0, total: 0, pageSize: 0 },
|
|
195
|
+
dataItemKey: f,
|
|
196
|
+
groupField: l = "",
|
|
199
197
|
textField: i,
|
|
200
|
-
skipDisabledItems:
|
|
201
|
-
} = this.props, b = this.value, I =
|
|
202
|
-
if (k.syntheticEvent = e, !
|
|
203
|
-
if (
|
|
204
|
-
|
|
205
|
-
else if (m &&
|
|
198
|
+
skipDisabledItems: c = !0
|
|
199
|
+
} = this.props, r = x(this.props), b = this.value, I = r.findIndex((y) => E(y, b, f)), m = this.props.opened !== void 0 ? this.props.opened : this.state.opened, d = e.keyCode, w = d === v.home || d === v.end, C = d === v.up || d === v.down, N = !m && (e.altKey && d === v.down || d === v.enter || d === v.space), D = m && (e.altKey && d === v.up || d === v.esc), O = n && (d === v.left || d === v.right), P = C || O && !t || w, k = this.base.initState();
|
|
200
|
+
if (k.syntheticEvent = e, !a) {
|
|
201
|
+
if (w && this.base.vs.enabled)
|
|
202
|
+
d === v.home ? o.skip !== 0 ? (this.base.triggerOnPageChange(k, 0, o.pageSize), this._navigated = !0) : this.triggerOnChange(r[0], k) : o.skip < o.total - o.pageSize ? (this.base.triggerOnPageChange(k, o.total - o.pageSize, o.pageSize), this._navigated = !0) : this.triggerOnChange(r[r.length - 1], k);
|
|
203
|
+
else if (m && d === v.pageUp)
|
|
206
204
|
e.preventDefault(), this.base.scrollPopupByPageSize(-1);
|
|
207
|
-
else if (m &&
|
|
205
|
+
else if (m && d === v.pageDown)
|
|
208
206
|
e.preventDefault(), this.base.scrollPopupByPageSize(1);
|
|
209
|
-
else if (m &&
|
|
207
|
+
else if (m && d === v.enter) {
|
|
210
208
|
const y = this.getFocusedIndex();
|
|
211
|
-
this.haveFocusedItemAndDataNotEmpty(
|
|
212
|
-
} else if (
|
|
213
|
-
|
|
214
|
-
else if (
|
|
215
|
-
if (this._lastKeypressIsFilter = !1,
|
|
216
|
-
if (!
|
|
217
|
-
this.onNavigate(k,
|
|
209
|
+
this.haveFocusedItemAndDataNotEmpty(r, y) ? (this.triggerOnChange(null, k), this.applyState(k)) : this.handleItemSelect(y, k), this.base.togglePopup(k), e.preventDefault();
|
|
210
|
+
} else if (N || D)
|
|
211
|
+
D && this.resetValueIfDisabledItem(), this.base.togglePopup(k), e.preventDefault();
|
|
212
|
+
else if (P) {
|
|
213
|
+
if (this._lastKeypressIsFilter = !1, l !== "" && i)
|
|
214
|
+
if (!c && m)
|
|
215
|
+
this.onNavigate(k, d);
|
|
218
216
|
else {
|
|
219
217
|
let y;
|
|
220
|
-
if (
|
|
221
|
-
const
|
|
222
|
-
y =
|
|
223
|
-
} else if (
|
|
224
|
-
let
|
|
225
|
-
if (I === 0 &&
|
|
218
|
+
if (d === v.down || d === v.right) {
|
|
219
|
+
const g = r.slice(I + 1).find((u) => !u.disabled && u[i]);
|
|
220
|
+
y = g && r.findIndex((u) => u[i] === g[i]);
|
|
221
|
+
} else if (d === v.up || d === v.left) {
|
|
222
|
+
let g;
|
|
223
|
+
if (I === 0 && p)
|
|
226
224
|
y = -1;
|
|
227
225
|
else if (I === -1)
|
|
228
|
-
|
|
226
|
+
g = r, y = r.findIndex((u) => !u.disabled && u[i]);
|
|
229
227
|
else {
|
|
230
|
-
|
|
231
|
-
let u =
|
|
228
|
+
g = r.slice(0, I);
|
|
229
|
+
let u = g.pop();
|
|
232
230
|
for (; u && u.disabled; )
|
|
233
|
-
u =
|
|
234
|
-
y = u &&
|
|
231
|
+
u = g.pop();
|
|
232
|
+
y = u && r.findIndex((M) => M[i] === u[i]);
|
|
235
233
|
}
|
|
236
234
|
}
|
|
237
235
|
if (y !== void 0) {
|
|
238
|
-
const
|
|
239
|
-
this.onNavigate(k,
|
|
236
|
+
const g = y - I;
|
|
237
|
+
this.onNavigate(k, d, g);
|
|
240
238
|
} else
|
|
241
|
-
y === void 0 &&
|
|
239
|
+
y === void 0 && r.findIndex((g) => g[i] === b[i]) === r.length - 1 && this.onNavigate(k, d);
|
|
242
240
|
}
|
|
243
|
-
else if (!
|
|
244
|
-
this.onNavigate(k,
|
|
241
|
+
else if (!c && m || w)
|
|
242
|
+
this.onNavigate(k, d);
|
|
245
243
|
else if (i) {
|
|
246
244
|
let y;
|
|
247
|
-
if (
|
|
248
|
-
const
|
|
249
|
-
y =
|
|
250
|
-
} else if (
|
|
251
|
-
let
|
|
252
|
-
if (I === 0 &&
|
|
245
|
+
if (d === v.down || d === v.right) {
|
|
246
|
+
const g = r.slice(I + 1).find((u) => !u.disabled && u[i]);
|
|
247
|
+
y = g && r.findIndex((u) => u[i] === g[i]);
|
|
248
|
+
} else if (d === v.up || d === v.left) {
|
|
249
|
+
let g;
|
|
250
|
+
if (I === 0 && p)
|
|
253
251
|
y = -1;
|
|
254
252
|
else if (I === -1)
|
|
255
|
-
|
|
253
|
+
g = r, y = r.find((u) => !u.disabled && u[i]);
|
|
256
254
|
else {
|
|
257
|
-
|
|
258
|
-
let u =
|
|
255
|
+
g = r.slice(0, I);
|
|
256
|
+
let u = g.pop();
|
|
259
257
|
for (; u && u.disabled; )
|
|
260
|
-
u =
|
|
261
|
-
y = u &&
|
|
258
|
+
u = g.pop();
|
|
259
|
+
y = u && r.findIndex((M) => M[i] === u[i]);
|
|
262
260
|
}
|
|
263
261
|
}
|
|
264
262
|
if (y !== void 0) {
|
|
265
|
-
const
|
|
266
|
-
this.onNavigate(k,
|
|
263
|
+
const g = y - I;
|
|
264
|
+
this.onNavigate(k, d, g);
|
|
267
265
|
} else
|
|
268
|
-
y === void 0 &&
|
|
266
|
+
y === void 0 && r.findIndex((g) => g[i] === b[i]) === r.length - 1 && this.onNavigate(k, d);
|
|
269
267
|
} else
|
|
270
|
-
this.onNavigate(k,
|
|
268
|
+
this.onNavigate(k, d);
|
|
271
269
|
e.preventDefault();
|
|
272
270
|
}
|
|
273
271
|
this.applyState(k);
|
|
@@ -279,8 +277,8 @@ const ye = "Please select a value from the list!", { sizeMap: z, roundedMap: ke
|
|
|
279
277
|
}, this.handleBlur = (e) => {
|
|
280
278
|
if (this._skipFocusEvent || !this.state.focused)
|
|
281
279
|
return;
|
|
282
|
-
const t = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { adaptive: a } = this.props, { windowWidth:
|
|
283
|
-
|
|
280
|
+
const t = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { adaptive: a } = this.props, { windowWidth: p = 0 } = this.state, n = p <= $ && a, o = this.base.initState();
|
|
281
|
+
o.syntheticEvent = e, o.data.focused = !1, o.events.push({ type: "onBlur" }), t && this.resetValueIfDisabledItem(), t && !n && this.base.togglePopup(o), this.applyState(o);
|
|
284
282
|
}, this.handleDefaultItemClick = (e) => {
|
|
285
283
|
const t = this.base.initState();
|
|
286
284
|
t.syntheticEvent = e, this.base.togglePopup(t), this.triggerOnChange(this.props.defaultItem, t), this.applyState(t);
|
|
@@ -312,9 +310,9 @@ const ye = "Please select a value from the list!", { sizeMap: z, roundedMap: ke
|
|
|
312
310
|
);
|
|
313
311
|
}, this.setValidity = () => {
|
|
314
312
|
this._select && this._select.setCustomValidity && this._select.setCustomValidity(
|
|
315
|
-
this.validity.valid ? "" : this.props.validationMessage ||
|
|
313
|
+
this.validity.valid ? "" : this.props.validationMessage || ke
|
|
316
314
|
);
|
|
317
|
-
},
|
|
315
|
+
}, Q(fe);
|
|
318
316
|
}
|
|
319
317
|
get _inputId() {
|
|
320
318
|
return this.props.id + "-accessibility-id";
|
|
@@ -326,7 +324,7 @@ const ye = "Please select a value from the list!", { sizeMap: z, roundedMap: ke
|
|
|
326
324
|
return this.props.id + "-guid";
|
|
327
325
|
}
|
|
328
326
|
get document() {
|
|
329
|
-
if (
|
|
327
|
+
if (H)
|
|
330
328
|
return this.element && this.element.ownerDocument || document;
|
|
331
329
|
}
|
|
332
330
|
/**
|
|
@@ -340,14 +338,14 @@ const ye = "Please select a value from the list!", { sizeMap: z, roundedMap: ke
|
|
|
340
338
|
*/
|
|
341
339
|
get value() {
|
|
342
340
|
let s;
|
|
343
|
-
return this._valueDuringOnChange !== void 0 ? s = this._valueDuringOnChange : this.props.value !== void 0 ? s = this.props.value : this.state.value !== void 0 ? s = this.state.value : this.props.defaultValue !== void 0 && (s = this.props.defaultValue), !
|
|
341
|
+
return this._valueDuringOnChange !== void 0 ? s = this._valueDuringOnChange : this.props.value !== void 0 ? s = this.props.value : this.state.value !== void 0 ? s = this.state.value : this.props.defaultValue !== void 0 && (s = this.props.defaultValue), !q(s) && this.props.defaultItem !== void 0 && (s = this.props.defaultItem), s;
|
|
344
342
|
}
|
|
345
343
|
/**
|
|
346
344
|
* The index of the selected item.
|
|
347
345
|
*/
|
|
348
346
|
get index() {
|
|
349
|
-
const {
|
|
350
|
-
return
|
|
347
|
+
const { dataItemKey: s } = this.props, e = x(this.props), t = this.value;
|
|
348
|
+
return e.findIndex((a) => E(a, t, s));
|
|
351
349
|
}
|
|
352
350
|
/**
|
|
353
351
|
* Gets the `name` property of the DropDownList.
|
|
@@ -367,28 +365,28 @@ const ye = "Please select a value from the list!", { sizeMap: z, roundedMap: ke
|
|
|
367
365
|
};
|
|
368
366
|
}
|
|
369
367
|
get validityStyles() {
|
|
370
|
-
return this.props.validityStyles !== void 0 ? this.props.validityStyles :
|
|
368
|
+
return this.props.validityStyles !== void 0 ? this.props.validityStyles : _.defaultProps.validityStyles;
|
|
371
369
|
}
|
|
372
370
|
/**
|
|
373
371
|
* @hidden
|
|
374
372
|
*/
|
|
375
373
|
get required() {
|
|
376
|
-
return this.props.required !== void 0 ? this.props.required :
|
|
374
|
+
return this.props.required !== void 0 ? this.props.required : _.defaultProps.required;
|
|
377
375
|
}
|
|
378
376
|
/**
|
|
379
377
|
* @hidden
|
|
380
378
|
*/
|
|
381
379
|
componentDidUpdate(s, e) {
|
|
382
|
-
var
|
|
383
|
-
const { dataItemKey: t, virtual: a, groupField:
|
|
384
|
-
if (this.base.didUpdate(), this.base.getPopupSettings().animate ||
|
|
380
|
+
var r;
|
|
381
|
+
const { dataItemKey: t, virtual: a, groupField: p = "", textField: n } = this.props, o = x(this.props), f = s.virtual ? s.virtual.total : 0, l = this.props.opened !== void 0 ? this.props.opened : this.state.opened, i = s.opened !== void 0 ? s.opened : e.opened, c = !i && l;
|
|
382
|
+
if (this.base.didUpdate(), this.base.getPopupSettings().animate || c && this.onPopupOpened(), a && a.total !== f)
|
|
385
383
|
this.base.vs.calcScrollElementHeight(), this.base.vs.reset();
|
|
386
384
|
else {
|
|
387
385
|
const b = this.value, I = s.value !== void 0 ? s.value : e.value;
|
|
388
|
-
let m =
|
|
389
|
-
|
|
390
|
-
const
|
|
391
|
-
|
|
386
|
+
let m = o.findIndex((w) => E(w, b, t));
|
|
387
|
+
p !== "" && b && n && (m = (r = this.base.getGroupedDataModernMode(o, p)) == null ? void 0 : r.map((w) => w[n]).indexOf(b[n]));
|
|
388
|
+
const d = !E(I, b, t);
|
|
389
|
+
c && a ? this.base.scrollToVirtualItem(a, m) : c && !a ? (this.onPopupOpened(), o && o.length !== 0 && this.base.resetGroupStickyHeader(o[0][p], this), this.base.scrollToItem(m)) : l && i && b && d && !this._navigated ? this.base.scrollToItem(m, this.base.vs.enabled) : l && i && this._navigated && (this._navigated && a && a.skip === 0 ? this.base.vs.reset() : this._navigated && a && a.skip === a.total - a.pageSize && this.base.vs.scrollToEnd());
|
|
392
390
|
}
|
|
393
391
|
this._navigated = !1, this.setValidity();
|
|
394
392
|
}
|
|
@@ -397,7 +395,7 @@ const ye = "Please select a value from the list!", { sizeMap: z, roundedMap: ke
|
|
|
397
395
|
*/
|
|
398
396
|
componentDidMount() {
|
|
399
397
|
var s;
|
|
400
|
-
this.observerResize =
|
|
398
|
+
this.observerResize = H && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this)), this.base.didMount(), this.setValidity(), (s = this.document) != null && s.body && this.observerResize && this.observerResize.observe(this.document.body);
|
|
401
399
|
}
|
|
402
400
|
/** @hidden */
|
|
403
401
|
componentWillUnmount() {
|
|
@@ -408,43 +406,42 @@ const ye = "Please select a value from the list!", { sizeMap: z, roundedMap: ke
|
|
|
408
406
|
* @hidden
|
|
409
407
|
*/
|
|
410
408
|
render() {
|
|
411
|
-
const s =
|
|
412
|
-
|
|
409
|
+
const s = ge(this).toLanguageString(G, ve[G]), { style: e, className: t, label: a, dir: p, virtual: n, size: o, rounded: f, fillMode: l, adaptive: i } = this.props, { windowWidth: c = 0 } = this.state, r = this.props.opened !== void 0 ? this.props.opened : this.state.opened, b = this.value, I = K(b, this.props.textField), m = !this.validityStyles || this.validity.valid, d = this.base, w = d.vs, C = c <= $ && i;
|
|
410
|
+
w.enabled = n !== void 0, n !== void 0 && (d.vs.skip = n.skip, d.vs.total = n.total, d.vs.pageSize = n.pageSize);
|
|
413
411
|
const {
|
|
414
|
-
dataItemKey:
|
|
415
|
-
data: M = [],
|
|
412
|
+
dataItemKey: N,
|
|
416
413
|
disabled: D,
|
|
417
|
-
tabIndex:
|
|
418
|
-
loading:
|
|
419
|
-
iconClassName:
|
|
420
|
-
svgIcon:
|
|
421
|
-
valueRender:
|
|
422
|
-
} = this.props, { focused:
|
|
414
|
+
tabIndex: O,
|
|
415
|
+
loading: P,
|
|
416
|
+
iconClassName: k,
|
|
417
|
+
svgIcon: y,
|
|
418
|
+
valueRender: g
|
|
419
|
+
} = this.props, u = x(this.props), { focused: M } = this.state, j = u.findIndex((F) => E(F, b, N)), V = /* @__PURE__ */ h.createElement("span", { id: this._inputId, className: "k-input-inner" }, I && /* @__PURE__ */ h.createElement("span", { className: "k-input-value-text" }, I)), J = g !== void 0 ? g.call(void 0, V, b) : V, A = /* @__PURE__ */ h.createElement(h.Fragment, null, /* @__PURE__ */ h.createElement(
|
|
423
420
|
"span",
|
|
424
421
|
{
|
|
425
422
|
ref: this.componentRef,
|
|
426
|
-
className:
|
|
423
|
+
className: L(
|
|
427
424
|
"k-dropdownlist k-picker",
|
|
428
425
|
t,
|
|
429
426
|
{
|
|
430
|
-
[`k-picker-${
|
|
431
|
-
[`k-rounded-${
|
|
432
|
-
[`k-picker-${
|
|
433
|
-
"k-focus":
|
|
427
|
+
[`k-picker-${T[o] || o}`]: o,
|
|
428
|
+
[`k-rounded-${Se[f] || f}`]: f,
|
|
429
|
+
[`k-picker-${l}`]: l,
|
|
430
|
+
"k-focus": M,
|
|
434
431
|
"k-disabled": D,
|
|
435
432
|
"k-invalid": !m,
|
|
436
|
-
"k-loading":
|
|
433
|
+
"k-loading": P,
|
|
437
434
|
"k-required": this.required
|
|
438
435
|
}
|
|
439
436
|
),
|
|
440
437
|
style: a ? { ...e, width: void 0 } : e,
|
|
441
|
-
dir:
|
|
442
|
-
onMouseDown:
|
|
443
|
-
|
|
438
|
+
dir: p,
|
|
439
|
+
onMouseDown: r ? (F) => {
|
|
440
|
+
F.target.nodeName !== "INPUT" && (this.focusElement(this.base.wrapper), F.preventDefault());
|
|
444
441
|
} : void 0,
|
|
445
442
|
onFocus: this.handleFocus,
|
|
446
443
|
onBlur: this.handleBlur,
|
|
447
|
-
tabIndex:
|
|
444
|
+
tabIndex: Z(O, D),
|
|
448
445
|
accessKey: this.props.accessKey,
|
|
449
446
|
onKeyDown: this.handleKeyDown,
|
|
450
447
|
onKeyPress: this.handleKeyPress,
|
|
@@ -453,81 +450,80 @@ const ye = "Please select a value from the list!", { sizeMap: z, roundedMap: ke
|
|
|
453
450
|
"aria-required": this.required,
|
|
454
451
|
"aria-disabled": D || void 0,
|
|
455
452
|
"aria-haspopup": "listbox",
|
|
456
|
-
"aria-expanded":
|
|
453
|
+
"aria-expanded": r || !1,
|
|
457
454
|
"aria-owns": this._listboxId,
|
|
458
|
-
"aria-activedescendant":
|
|
455
|
+
"aria-activedescendant": r ? "option-" + this._guid + "-" + (j + (n ? n.skip : 0)) : void 0,
|
|
459
456
|
"aria-label": this.props.ariaLabel || this.props.label,
|
|
460
457
|
"aria-labelledby": this.props.ariaLabelledBy,
|
|
461
458
|
"aria-describedby": this.props.ariaDescribedBy || this._inputId,
|
|
462
459
|
id: this.props.id,
|
|
463
460
|
title: this.props.title
|
|
464
461
|
},
|
|
465
|
-
|
|
466
|
-
|
|
462
|
+
J,
|
|
463
|
+
P && /* @__PURE__ */ h.createElement(ee, { className: "k-input-loading-icon", name: "loading" }),
|
|
467
464
|
/* @__PURE__ */ h.createElement(
|
|
468
|
-
|
|
465
|
+
U,
|
|
469
466
|
{
|
|
470
467
|
tabIndex: -1,
|
|
471
468
|
type: "button",
|
|
472
469
|
"aria-label": s,
|
|
473
470
|
"aria-hidden": !0,
|
|
474
|
-
size:
|
|
475
|
-
fillMode:
|
|
476
|
-
iconClass:
|
|
471
|
+
size: o,
|
|
472
|
+
fillMode: l,
|
|
473
|
+
iconClass: k,
|
|
477
474
|
className: "k-input-button",
|
|
478
475
|
rounded: null,
|
|
479
476
|
themeColor: "base",
|
|
480
|
-
icon:
|
|
481
|
-
svgIcon:
|
|
482
|
-
onMouseDown: (
|
|
477
|
+
icon: k ? void 0 : "caret-alt-down",
|
|
478
|
+
svgIcon: y || ne,
|
|
479
|
+
onMouseDown: (F) => this.state.focused && F.preventDefault()
|
|
483
480
|
}
|
|
484
481
|
),
|
|
485
482
|
this.dummySelect(b),
|
|
486
|
-
!
|
|
487
|
-
),
|
|
483
|
+
!C && this.renderListContainer()
|
|
484
|
+
), C && this.renderAdaptiveListContainer());
|
|
488
485
|
return a ? /* @__PURE__ */ h.createElement(
|
|
489
|
-
|
|
486
|
+
oe,
|
|
490
487
|
{
|
|
491
488
|
label: a,
|
|
492
489
|
editorValue: I,
|
|
493
490
|
editorValid: m,
|
|
494
491
|
editorDisabled: this.props.disabled,
|
|
495
492
|
style: { width: e ? e.width : void 0 },
|
|
496
|
-
children:
|
|
493
|
+
children: A
|
|
497
494
|
}
|
|
498
|
-
) :
|
|
495
|
+
) : A;
|
|
499
496
|
}
|
|
500
497
|
/**
|
|
501
498
|
* @hidden
|
|
502
499
|
*/
|
|
503
500
|
onNavigate(s, e, t) {
|
|
504
501
|
const {
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
dataItemKey: o,
|
|
502
|
+
defaultItem: a,
|
|
503
|
+
dataItemKey: p,
|
|
508
504
|
virtual: n = { skip: 0, total: 0, pageSize: 0 }
|
|
509
|
-
} = this.props,
|
|
510
|
-
current: n.skip +
|
|
511
|
-
max: (
|
|
512
|
-
min:
|
|
505
|
+
} = this.props, o = x(this.props), f = this.base.vs, l = this.value, i = o.findIndex((r) => E(r, l, p)), c = this.base.navigation.navigate({
|
|
506
|
+
current: n.skip + i,
|
|
507
|
+
max: (f.enabled ? n.total : o.length) - 1,
|
|
508
|
+
min: a !== void 0 ? -1 : 0,
|
|
513
509
|
keyCode: e,
|
|
514
510
|
skipItems: t || void 0
|
|
515
511
|
});
|
|
516
|
-
|
|
512
|
+
c !== void 0 && this.handleItemSelect(c, s), this.applyState(s);
|
|
517
513
|
}
|
|
518
514
|
renderAdaptiveListContainer() {
|
|
519
|
-
const { windowWidth: s = 0 } = this.state, { header: e, footer: t, size: a, adaptiveTitle:
|
|
515
|
+
const { windowWidth: s = 0 } = this.state, { header: e, footer: t, size: a, adaptiveTitle: p, groupField: n, groupStickyHeaderItemRender: o, list: f } = this.props, l = x(this.props), i = this.props.opened !== void 0 ? this.props.opened : this.state.opened, c = {
|
|
520
516
|
navigatable: !1,
|
|
521
517
|
navigatableElements: [],
|
|
522
|
-
expand:
|
|
518
|
+
expand: i,
|
|
523
519
|
animation: !0,
|
|
524
520
|
onClose: (b) => this.handleWrapperClick(b),
|
|
525
|
-
animationStyles: s <=
|
|
526
|
-
className: s <=
|
|
521
|
+
animationStyles: s <= Y ? { top: 0, width: "100%", height: "100%" } : void 0,
|
|
522
|
+
className: s <= Y ? "k-adaptive-actionsheet k-actionsheet-fullscreen" : "k-adaptive-actionsheet k-actionsheet-bottom"
|
|
527
523
|
};
|
|
528
|
-
let { group:
|
|
529
|
-
return
|
|
530
|
-
|
|
524
|
+
let { group: r } = this.state;
|
|
525
|
+
return r === void 0 && n !== void 0 && (r = K(l[0], n)), /* @__PURE__ */ h.createElement(be, { ...c }, /* @__PURE__ */ h.createElement(Ie, { className: "k-text-center" }, /* @__PURE__ */ h.createElement("div", { className: "k-actionsheet-titlebar-group k-hbox" }, /* @__PURE__ */ h.createElement("div", { className: "k-actionsheet-title" }, /* @__PURE__ */ h.createElement("div", null, p)), /* @__PURE__ */ h.createElement("div", { className: "k-actionsheet-actions" }, /* @__PURE__ */ h.createElement(
|
|
526
|
+
U,
|
|
531
527
|
{
|
|
532
528
|
tabIndex: 0,
|
|
533
529
|
"aria-label": "Cancel",
|
|
@@ -536,41 +532,40 @@ const ye = "Please select a value from the list!", { sizeMap: z, roundedMap: ke
|
|
|
536
532
|
fillMode: "flat",
|
|
537
533
|
onClick: this.handleWrapperClick,
|
|
538
534
|
icon: "x",
|
|
539
|
-
svgIcon:
|
|
535
|
+
svgIcon: re
|
|
540
536
|
}
|
|
541
|
-
))), /* @__PURE__ */ h.createElement("div", { className: "k-actionsheet-titlebar-group k-actionsheet-filter" }, this.renderListFilter())), /* @__PURE__ */ h.createElement(
|
|
537
|
+
))), /* @__PURE__ */ h.createElement("div", { className: "k-actionsheet-titlebar-group k-actionsheet-filter" }, this.renderListFilter())), /* @__PURE__ */ h.createElement(ye, { className: "!k-overflow-hidden" }, e && /* @__PURE__ */ h.createElement("div", { className: "k-list-header" }, e), /* @__PURE__ */ h.createElement(
|
|
542
538
|
"div",
|
|
543
539
|
{
|
|
544
|
-
className:
|
|
540
|
+
className: L(
|
|
545
541
|
"k-list",
|
|
546
542
|
{
|
|
547
|
-
[`k-list-${
|
|
543
|
+
[`k-list-${T[a] || a}`]: a,
|
|
548
544
|
"k-virtual-list": this.base.vs.enabled
|
|
549
545
|
}
|
|
550
546
|
)
|
|
551
547
|
},
|
|
552
548
|
this.renderDefaultItem(),
|
|
553
|
-
!
|
|
549
|
+
!f && r && l.length !== 0 && /* @__PURE__ */ h.createElement(B, { group: r, groupMode: "modern", render: o }),
|
|
554
550
|
this.renderList()
|
|
555
551
|
), t && /* @__PURE__ */ h.createElement("div", { className: "k-list-footer" }, t)));
|
|
556
552
|
}
|
|
557
553
|
getFocusedIndex() {
|
|
558
554
|
const s = this.value, {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
focusedItemIndex: o = ue,
|
|
555
|
+
textField: e,
|
|
556
|
+
dataItemKey: t,
|
|
557
|
+
virtual: a = { skip: 0 },
|
|
558
|
+
focusedItemIndex: p = me,
|
|
564
559
|
filterable: n,
|
|
565
|
-
skipDisabledItems:
|
|
566
|
-
} = this.props,
|
|
567
|
-
return
|
|
560
|
+
skipDisabledItems: o = !0
|
|
561
|
+
} = this.props, f = x(this.props), l = this.props.filter ? this.props.filter : this.state.text;
|
|
562
|
+
return o && e && !l && !s ? f.findIndex((i) => !i.disabled && i[e]) : q(s) && l === void 0 || n && l === "" ? f.findIndex((i) => E(i, s, t)) : l ? this._lastKeypressIsFilter ? p(f, l, e) : f.findIndex((i) => E(i, s, t)) : a.skip === 0 ? 0 : -1;
|
|
568
563
|
}
|
|
569
564
|
focusElement(s) {
|
|
570
565
|
this._skipFocusEvent = !0, s.focus(), window.setTimeout(() => this._skipFocusEvent = !1, 30);
|
|
571
566
|
}
|
|
572
567
|
triggerOnChange(s, e) {
|
|
573
|
-
|
|
568
|
+
E(this.value, s, this.props.dataItemKey) || (this.props.value === void 0 && (e.data.value = s), this._valueDuringOnChange = s, e.events.push({ type: "onChange" }));
|
|
574
569
|
}
|
|
575
570
|
applyState(s) {
|
|
576
571
|
this.base.applyState(s), this._valueDuringOnChange = void 0;
|
|
@@ -580,18 +575,18 @@ const ye = "Please select a value from the list!", { sizeMap: z, roundedMap: ke
|
|
|
580
575
|
this.setState({ windowWidth: e.target.clientWidth });
|
|
581
576
|
}
|
|
582
577
|
resetValueIfDisabledItem() {
|
|
583
|
-
const
|
|
578
|
+
const s = x(this.props), e = this.base.initState(), t = this.getFocusedIndex();
|
|
584
579
|
this.haveFocusedItemAndDataNotEmpty(s, t) && (this.triggerOnChange(null, e), this.applyState(e));
|
|
585
580
|
}
|
|
586
581
|
haveFocusedItemAndDataNotEmpty(s, e) {
|
|
587
582
|
return e !== void 0 && e !== -1 && s && s.length > 0 && s[e].disabled;
|
|
588
583
|
}
|
|
589
584
|
};
|
|
590
|
-
|
|
585
|
+
_.displayName = "DropDownList", _.propTypes = {
|
|
591
586
|
delay: S.number,
|
|
592
587
|
ignoreCase: S.bool,
|
|
593
588
|
iconClassName: S.string,
|
|
594
|
-
svgIcon:
|
|
589
|
+
svgIcon: X,
|
|
595
590
|
defaultItem: S.any,
|
|
596
591
|
valueRender: S.func,
|
|
597
592
|
valueMap: S.func,
|
|
@@ -607,26 +602,26 @@ E.displayName = "DropDownList", E.propTypes = {
|
|
|
607
602
|
list: S.any,
|
|
608
603
|
skipDisabledItems: S.bool,
|
|
609
604
|
renderListFilterWrapper: S.bool,
|
|
610
|
-
...
|
|
611
|
-
},
|
|
605
|
+
...z.propTypes
|
|
606
|
+
}, _.defaultProps = {
|
|
612
607
|
delay: 500,
|
|
613
608
|
tabIndex: 0,
|
|
614
609
|
ignoreCase: !0,
|
|
615
|
-
...
|
|
610
|
+
...z.defaultProps,
|
|
616
611
|
required: !1,
|
|
617
612
|
size: "medium",
|
|
618
613
|
rounded: "medium",
|
|
619
614
|
fillMode: "solid",
|
|
620
615
|
groupMode: "modern"
|
|
621
616
|
};
|
|
622
|
-
let
|
|
623
|
-
const
|
|
624
|
-
|
|
625
|
-
|
|
617
|
+
let R = _;
|
|
618
|
+
const xe = te(), we = se(ie(
|
|
619
|
+
xe,
|
|
620
|
+
R
|
|
626
621
|
));
|
|
627
|
-
|
|
622
|
+
we.displayName = "KendoReactDropDownList";
|
|
628
623
|
export {
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
624
|
+
we as DropDownList,
|
|
625
|
+
xe as DropDownListPropsContext,
|
|
626
|
+
R as DropDownListWithoutContext
|
|
632
627
|
};
|