@progress/kendo-react-dropdowns 9.0.0-develop.17 → 9.0.0-develop.19

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.
@@ -6,632 +6,642 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import * as u from "react";
10
- import C from "prop-types";
11
- import { classNames as x, uDropDownList as D, Keys as I, validatePackage as ee, svgIconPropType as te, canUseDOM as B, getTabIndex as se, IconWrap as ie, uDropDownsActionSheet as K, createPropsContext as ae, withIdHOC as oe, withPropsContext as ne, withUnstyledHOC as re } from "@progress/kendo-react-common";
12
- import { FloatingLabel as le } from "@progress/kendo-react-labels";
13
- import { caretAltDownIcon as de, xIcon as pe } from "@progress/kendo-svg-icons";
14
- import he from "../common/ListContainer.mjs";
15
- import ce from "../common/ListFilter.mjs";
16
- import W from "../common/GroupStickyHeader.mjs";
17
- import ue from "../common/ListDefaultItem.mjs";
18
- import me from "../common/List.mjs";
19
- import R from "../common/DropDownBase.mjs";
20
- import { getFilteredData as E, areSame as k, getItemValue as T, sameCharsOnly as fe, shuffleData as ge, matchText as q, isPresent as U, itemIndexStartsWith as ve } from "../common/utils.mjs";
21
- import { packageMetadata as be } from "../package-metadata.mjs";
22
- import { Button as G } from "@progress/kendo-react-buttons";
23
- import { provideLocalizationService as Ie } from "@progress/kendo-react-intl";
24
- import { dropDownListArrowBtnAriaLabel as Y, messages as ye } from "../messages/index.mjs";
25
- import { MOBILE_SMALL_DEVISE as $, MOBILE_MEDIUM_DEVISE as j } from "../common/constants.mjs";
26
- import { ActionSheet as we, ActionSheetHeader as Se, ActionSheetContent as xe } from "@progress/kendo-react-layout";
27
- const Ce = "Please select a value from the list!", N = class N extends u.Component {
28
- constructor(s) {
29
- super(s), this.state = {}, this._element = null, this.base = new R(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
- this.base.wrapper && this.base.wrapper.focus({ preventScroll: !0 });
31
- }, this.handleItemSelect = (e, t) => {
32
- const { virtual: a, dataItemKey: h, defaultItem: n } = this.props, l = E(this.props), b = a ? a.skip : 0, d = e === -1 && n !== void 0 ? n : l[e - b], i = !k(d, this.value, h);
33
- this.triggerOnChange(d, t), i && this.base.triggerPageChangeCornerItems(d, t);
34
- }, this.componentRef = (e) => {
35
- this._element = e, this.base.wrapper = e;
36
- }, this.dummySelect = (e) => /* @__PURE__ */ u.createElement(
37
- "select",
38
- {
39
- name: this.props.name,
40
- ref: (t) => {
41
- this._select = t;
42
- },
43
- tabIndex: -1,
44
- "aria-hidden": !0,
45
- title: this.props.label,
46
- style: { opacity: 0, width: 1, border: 0, zIndex: -1, position: "absolute", left: "50%" }
9
+ import * as i from "react";
10
+ import k from "prop-types";
11
+ import { validatePackage as Yt, useUnstyled as $t, useId as jt, usePropsContext as Jt, canUseDOM as tt, classNames as C, uDropDownList as M, getTabIndex as Qt, IconWrap as Xt, svgIconPropType as Zt, createPropsContext as Rt, Keys as w, uDropDownsActionSheet as J } from "@progress/kendo-react-common";
12
+ import { FloatingLabel as en } from "@progress/kendo-react-labels";
13
+ import { caretAltDownIcon as tn, xIcon as nn } from "@progress/kendo-svg-icons";
14
+ import rn from "../common/ListContainer.mjs";
15
+ import on from "../common/ListFilter.mjs";
16
+ import nt from "../common/GroupStickyHeader.mjs";
17
+ import an from "../common/ListDefaultItem.mjs";
18
+ import ln from "../common/List.mjs";
19
+ import dt from "../common/DropDownBase.mjs";
20
+ import { getFilteredData as P, areSame as N, getItemValue as fe, isPresent as rt, itemIndexStartsWith as sn, sameCharsOnly as dn, shuffleData as cn, matchText as ot } from "../common/utils.mjs";
21
+ import { packageMetadata as un } from "../package-metadata.mjs";
22
+ import { Button as it } from "@progress/kendo-react-buttons";
23
+ import { useLocalization as pn } from "@progress/kendo-react-intl";
24
+ import { dropDownListArrowBtnAriaLabel as at, messages as mn } from "../messages/index.mjs";
25
+ import { MOBILE_SMALL_DEVISE as lt, MOBILE_MEDIUM_DEVISE as st } from "../common/constants.mjs";
26
+ import { ActionSheet as fn, ActionSheetHeader as gn, ActionSheetContent as vn } from "@progress/kendo-react-layout";
27
+ const In = "Please select a value from the list!", Ne = i.forwardRef((E, ct) => {
28
+ Yt(un);
29
+ const F = $t(), ge = jt(E.id), r = Jt(hn, E), {
30
+ delay: ut = O.delay,
31
+ tabIndex: pt = O.tabIndex,
32
+ ignoreCase: ve = O.ignoreCase,
33
+ size: Q = O.size,
34
+ rounded: Fe = O.rounded,
35
+ fillMode: Ie = O.fillMode,
36
+ groupMode: wn = O.groupMode
37
+ } = r, he = () => {
38
+ if (tt)
39
+ return q.current && q.current.ownerDocument || window.document;
40
+ }, mt = () => {
41
+ var e, n;
42
+ (e = t == null ? void 0 : t.current) != null && e.wrapper && ((n = t == null ? void 0 : t.current) == null || n.wrapper.focus({ preventScroll: !0 }));
43
+ }, L = () => {
44
+ let e;
45
+ return V.current !== void 0 && V.current !== null ? e = V.current : r.value !== void 0 ? e = r.value : m.value !== void 0 && m.value !== null ? e = m.value : r.defaultValue !== void 0 && r.defaultValue !== null && (e = r.defaultValue), !rt(e) && r.defaultItem !== void 0 && r.defaultItem !== null && (e = r.defaultItem), e;
46
+ }, ft = () => {
47
+ const { dataItemKey: e } = r, n = P(E), a = L();
48
+ return n.findIndex((c) => N(c, a, e));
49
+ }, we = () => r.required !== void 0 ? r.required : O.required, ye = () => {
50
+ const e = r.validationMessage !== void 0, n = L(), a = !we() || n !== null && n !== "" && n !== void 0, c = r.valid !== void 0 ? r.valid : a;
51
+ return {
52
+ customError: e,
53
+ valid: c,
54
+ valueMissing: n === null
55
+ };
56
+ }, gt = () => r.validityStyles !== void 0 ? r.validityStyles : O.validityStyles, ne = (e) => {
57
+ oe.current = !0, e.focus(), window.setTimeout(() => oe.current = !1, 30);
58
+ }, Se = () => {
59
+ Z.current && ne(Z.current), r.adaptive && setTimeout(() => {
60
+ Z.current && ne(Z.current);
61
+ }, 300);
62
+ }, vt = (e) => {
63
+ for (const n of e)
64
+ n.target.clientWidth !== ie.current.windowWidth && Y({ windowWidth: n.target.clientWidth });
65
+ }, Ke = () => {
66
+ re.current && re.current.setCustomValidity && re.current.setCustomValidity(
67
+ ye().valid ? "" : r.validationMessage || In
68
+ );
69
+ }, U = (e, n) => {
70
+ const a = L();
71
+ N(a, e, r.dataItemKey) || (r.value === void 0 && (n.data.value = e), t.current.updateComponentArgs({ value: e }), V.current = e, n.events.push({ type: "onChange" }));
72
+ }, K = (e) => {
73
+ var n;
74
+ (n = t == null ? void 0 : t.current) == null || n.applyState(e), V.current = void 0;
75
+ }, X = (e, n) => {
76
+ var s;
77
+ const { virtual: a, dataItemKey: c, defaultItem: d } = r, u = P(E), I = a ? a.skip : 0, f = L(), o = e === -1 && d !== void 0 ? d : u[e - I], p = !N(o, f, c);
78
+ U(o, n), p && ((s = t == null ? void 0 : t.current) == null || s.triggerPageChangeCornerItems(o, n));
79
+ }, A = (e, n, a) => {
80
+ var S, g;
81
+ const { defaultItem: c, dataItemKey: d, virtual: u = { skip: 0, total: 0, pageSize: 0 } } = r, I = L(), f = P(E), o = (S = t == null ? void 0 : t.current) == null ? void 0 : S.vs, p = f.findIndex((h) => N(h, I, d)), s = (g = t == null ? void 0 : t.current) == null ? void 0 : g.navigation.navigate({
82
+ current: u.skip + p,
83
+ max: (o != null && o.enabled ? u.total : f.length) - 1,
84
+ min: c !== void 0 ? -1 : 0,
85
+ keyCode: n,
86
+ skipItems: a || void 0
87
+ });
88
+ s !== void 0 && X(s, e), K(e);
89
+ }, It = (e) => {
90
+ q.current = e, t.current.wrapper = e;
91
+ }, ht = (e) => /* @__PURE__ */ i.createElement(
92
+ "select",
93
+ {
94
+ name: r.name,
95
+ ref: (n) => {
96
+ re.current = n;
47
97
  },
48
- /* @__PURE__ */ u.createElement("option", { value: this.props.valueMap ? this.props.valueMap.call(void 0, e) : e })
49
- ), this.renderListContainer = () => {
50
- const { header: e, footer: t, dir: a, size: h, groupField: n, groupStickyHeaderItemRender: l, list: b, unstyled: d } = this.props, i = E(this.props), c = this.base, o = c.getPopupSettings(), f = this.props.opened !== void 0 ? this.props.opened : this.state.opened, g = o.width !== void 0 ? o.width : c.popupWidth, p = d && d.uDropDownList, r = {
51
- dir: a !== void 0 ? a : c.dirCalculated,
52
- width: g,
53
- popupSettings: {
54
- ...o,
55
- popupClass: x(
56
- o.popupClass,
57
- D.listContainer({
58
- c: p
59
- })
60
- ),
61
- anchor: o.anchor || this.element,
62
- show: f,
63
- onOpen: this.onPopupOpened,
64
- onClose: this.onPopupClosed,
65
- onMouseDownOutside: this.onPopupMouseDown
66
- },
67
- itemsCount: [i.length]
68
- };
69
- let { group: w } = this.state;
70
- return w === void 0 && n !== void 0 && (w = T(i[0], n)), /* @__PURE__ */ u.createElement(he, { ...r }, this.renderListFilter(), e && /* @__PURE__ */ u.createElement("div", { className: x(D.listHeader({ c: p })) }, e), /* @__PURE__ */ u.createElement(
71
- "div",
72
- {
73
- className: x(
74
- D.list({
75
- c: p,
76
- size: h,
77
- virtual: this.base.vs.enabled
78
- })
79
- )
80
- },
81
- this.renderDefaultItem(),
82
- !b && w && i.length !== 0 && /* @__PURE__ */ u.createElement(W, { group: w, groupMode: "modern", render: l }),
83
- this.renderList()
84
- ), t && /* @__PURE__ */ u.createElement("div", { className: x(D.listFooter({ c: p })) }, t));
85
- }, this.renderList = () => {
86
- const {
87
- textField: e,
88
- dataItemKey: t,
89
- virtual: a = { skip: 0, total: void 0 },
90
- groupHeaderItemRender: h,
91
- listNoDataRender: n,
92
- itemRender: l,
93
- unstyled: b
94
- } = this.props, d = E(this.props), i = b && b.uDropDownList, c = this.base.vs, o = a.skip, f = this.props.opened !== void 0 ? this.props.opened : this.state.opened, g = this.base.getPopupSettings(), p = `translateY(${c.translate}px)`;
95
- return /* @__PURE__ */ u.createElement(
96
- me,
97
- {
98
- id: this._listboxId,
99
- show: f,
100
- data: d.slice(),
101
- focusedIndex: this.getFocusedIndex(),
102
- value: this.value,
103
- textField: e,
104
- valueField: t,
105
- optionsGuid: this._guid,
106
- groupField: this.props.groupField,
107
- groupMode: "modern",
108
- listRef: (r) => c.list = this.base.list = r,
109
- wrapperStyle: { maxHeight: g.height },
110
- wrapperCssClass: x(D.listContent({ c: i })),
111
- listStyle: c.enabled ? { transform: p } : void 0,
112
- key: "listkey",
113
- skip: o,
114
- onClick: this.handleItemClick,
115
- itemRender: l,
116
- groupHeaderItemRender: h,
117
- noDataRender: n,
118
- onScroll: this.onScroll,
119
- wrapperRef: c.scrollerRef,
120
- scroller: this.base.renderScrollElement(),
121
- ariaSetSize: a.total
122
- }
123
- );
124
- }, this.onScroll = (e) => {
125
- const { vs: t, list: a } = this.base;
126
- t.scrollHandler(e);
127
- const { groupField: h } = this.props;
128
- let n = E(this.props);
129
- if (!(!h || !n.length) && h) {
130
- const l = this.itemHeight = this.itemHeight || (t.enabled ? t.itemHeight : a ? a.children[0].offsetHeight : 0), d = e.target.scrollTop - t.skip * l;
131
- n = this.base.getGroupedDataModernMode(n, h);
132
- let i = n[0][h];
133
- for (let c = 1; c < n.length && !(l * c > d); c++)
134
- n[c] && n[c][h] && (i = n[c][h]);
135
- i !== this.state.group && this.setState({
136
- group: i
137
- });
138
- }
139
- }, this.renderListFilter = () => {
140
- const e = this.props.filter !== void 0 ? this.props.filter : this.state.text;
141
- return this.props.filterable && /* @__PURE__ */ u.createElement(
142
- ce,
143
- {
144
- value: e,
145
- ref: (t) => this._filterInput = t && t.element,
146
- onChange: this.handleListFilterChange,
147
- onKeyDown: this.handleKeyDown,
148
- size: this.props.size,
149
- rounded: this.props.rounded,
150
- fillMode: this.props.fillMode,
151
- renderListFilterWrapper: !0
152
- }
153
- );
154
- }, this.renderDefaultItem = () => {
155
- const { textField: e, defaultItem: t, dataItemKey: a } = this.props;
156
- return t !== void 0 && /* @__PURE__ */ u.createElement(
157
- ue,
158
- {
159
- defaultItem: t,
160
- textField: e,
161
- selected: k(this.value, t, a),
162
- key: "defaultitemkey",
163
- onClick: this.handleDefaultItemClick
164
- }
165
- );
166
- }, this.search = (e) => {
167
- clearTimeout(this._typingTimeout), this.props.filterable || (this._typingTimeout = window.setTimeout(() => this.searchState.word = "", this.props.delay), this.selectNext(e));
168
- }, this.selectNext = (e) => {
169
- const { dataItemKey: t } = this.props, a = E(this.props);
170
- let h = a.map((F, M) => ({ item: F, itemIndex: M }));
171
- const n = this.searchState.word, l = this.searchState.last, b = fe(n, l);
172
- let d = h.length, i = Math.max(
173
- 0,
174
- a.findIndex((F) => k(F, this.value, t))
175
- ), c;
176
- this.props.defaultItem && (c = { item: this.props.defaultItem, itemIndex: -1 }, d += 1, i += 1), i += b ? 1 : 0, h = ge(h, i, c);
177
- let o, f, g, p = 0;
178
- const { textField: r, ignoreCase: w } = this.props;
179
- for (; p < d; p++)
180
- if (o = T(h[p].item, r), f = b && q(o, l, w), g = q(o, n, w), f || g) {
181
- p = h[p].itemIndex;
182
- break;
183
- }
184
- if (p !== d) {
185
- const F = this.base.initState();
186
- F.syntheticEvent = e, this.handleItemSelect(p, F), this.applyState(F), this._valueDuringOnChange = void 0;
187
- }
188
- }, this.handleKeyDown = (e) => {
189
- e && e.target instanceof Element && e.target.nodeName === "INPUT" && e.stopPropagation && e.stopPropagation();
190
- const {
191
- filterable: t,
192
- disabled: a,
193
- defaultItem: h,
194
- leftRightKeysNavigation: n = !0,
195
- virtual: l = { skip: 0, total: 0, pageSize: 0 },
196
- dataItemKey: b,
197
- groupField: d = "",
198
- textField: i,
199
- skipDisabledItems: c = !0
200
- } = this.props, o = E(this.props), f = this.value, g = o.findIndex((y) => k(y, f, b)), p = this.props.opened !== void 0 ? this.props.opened : this.state.opened, r = e.keyCode, w = r === I.home || r === I.end, F = r === I.up || r === I.down, M = !p && (e.altKey && r === I.down || r === I.enter || r === I.space), _ = p && (e.altKey && r === I.up || r === I.esc), z = n && (r === I.left || r === I.right), P = F || z && !t || w, S = this.base.initState();
201
- if (S.syntheticEvent = e, !a) {
202
- if (w && this.base.vs.enabled)
203
- r === I.home ? l.skip !== 0 ? (this.base.triggerOnPageChange(S, 0, l.pageSize), this._navigated = !0) : this.triggerOnChange(o[0], S) : l.skip < l.total - l.pageSize ? (this.base.triggerOnPageChange(S, l.total - l.pageSize, l.pageSize), this._navigated = !0) : this.triggerOnChange(o[o.length - 1], S);
204
- else if (p && r === I.pageUp)
205
- e.preventDefault(), this.base.scrollPopupByPageSize(-1);
206
- else if (p && r === I.pageDown)
207
- e.preventDefault(), this.base.scrollPopupByPageSize(1);
208
- else if (p && r === I.enter) {
209
- const y = this.getFocusedIndex();
210
- this.haveFocusedItemAndDataNotEmpty(o, y) ? (this.triggerOnChange(null, S), this.applyState(S)) : this.handleItemSelect(y, S), this.base.togglePopup(S), e.preventDefault();
211
- } else if (M || _)
212
- _ && this.resetValueIfDisabledItem(), this.base.togglePopup(S), e.preventDefault();
213
- else if (P) {
214
- if (this._lastKeypressIsFilter = !1, d !== "" && i)
215
- if (!c && p)
216
- this.onNavigate(S, r);
217
- else {
98
+ tabIndex: -1,
99
+ "aria-hidden": !0,
100
+ title: r.label,
101
+ style: { opacity: 0, width: 1, border: 0, zIndex: -1, position: "absolute", left: "50%" }
102
+ },
103
+ /* @__PURE__ */ i.createElement("option", { value: r.valueMap ? r.valueMap.call(void 0, e) : e })
104
+ ), De = () => {
105
+ const {
106
+ textField: e,
107
+ dataItemKey: n,
108
+ virtual: a = { skip: 0 },
109
+ focusedItemIndex: c = sn,
110
+ filterable: d,
111
+ skipDisabledItems: u = !0
112
+ } = r, I = L(), f = P(E), o = r.filter ? r.filter : m.text;
113
+ return u && e && !o && !I ? f.findIndex((p) => !p.disabled && p[e]) : rt(I) && o === void 0 || d && o === "" ? f.findIndex((p) => N(p, I, n)) : o ? Ee.current ? c(f, o, e) : f.findIndex((p) => N(p, I, n)) : a.skip === 0 ? 0 : -1;
114
+ }, Te = (e, n) => n !== void 0 && n !== -1 && e && e.length > 0 && e[n].disabled, xe = () => {
115
+ const e = P(E), n = t.current.initState(), a = De();
116
+ Te(e, a) && (U(null, n), K(n));
117
+ }, Ce = (e) => {
118
+ if (e.isPropagationStopped())
119
+ return;
120
+ const n = t.current.initState();
121
+ n.syntheticEvent = e, m.focused || (n.data.focused = !0), xe(), t.current.togglePopup(n), K(n);
122
+ }, Oe = (e) => {
123
+ var z, pe, W, me, j, Re, et;
124
+ e && e.target instanceof Element && e.target.nodeName === "INPUT" && e.stopPropagation && e.stopPropagation();
125
+ const {
126
+ filterable: n,
127
+ disabled: a,
128
+ defaultItem: c,
129
+ leftRightKeysNavigation: d = !0,
130
+ virtual: u = { skip: 0, total: 0, pageSize: 0 },
131
+ dataItemKey: I,
132
+ groupField: f = "",
133
+ textField: o,
134
+ skipDisabledItems: p = !0
135
+ } = r, s = P(E), S = L(), g = s.findIndex((x) => N(x, S, I)), h = r.opened !== void 0 ? r.opened : m.opened, l = e.keyCode, T = l === w.home || l === w.end, b = l === w.up || l === w.down, $ = !h && (e.altKey && l === w.down || l === w.enter || l === w.space), te = h && (e.altKey && l === w.up || l === w.esc), ce = d && (l === w.left || l === w.right), ue = b || ce && !n || T, D = t.current.initState();
136
+ if (D.syntheticEvent = e, !a) {
137
+ if (T && ((z = t == null ? void 0 : t.current) != null && z.vs.enabled))
138
+ l === w.home ? u.skip !== 0 ? ((pe = t == null ? void 0 : t.current) == null || pe.triggerOnPageChange(D, 0, u.pageSize), H.current = !0) : U(s[0], D) : u.skip < u.total - u.pageSize ? ((W = t == null ? void 0 : t.current) == null || W.triggerOnPageChange(
139
+ D,
140
+ u.total - u.pageSize,
141
+ u.pageSize
142
+ ), H.current = !0) : U(s[s.length - 1], D);
143
+ else if (h && l === w.pageUp)
144
+ e.preventDefault(), (me = t == null ? void 0 : t.current) == null || me.scrollPopupByPageSize(-1);
145
+ else if (h && l === w.pageDown)
146
+ e.preventDefault(), (j = t == null ? void 0 : t.current) == null || j.scrollPopupByPageSize(1);
147
+ else if (h && l === w.enter) {
148
+ const x = De();
149
+ Te(s, x) ? (U(null, D), K(D)) : X(x, D), (Re = t == null ? void 0 : t.current) == null || Re.togglePopup(D), e.preventDefault();
150
+ } else if ($ || te)
151
+ te && xe(), (et = t == null ? void 0 : t.current) == null || et.togglePopup(D), e.preventDefault();
152
+ else if (ue) {
153
+ if (Ee.current = !1, f !== "" && o)
154
+ if (!p && h)
155
+ A(D, l);
156
+ else {
157
+ let x;
158
+ if (l === w.down || l === w.right) {
159
+ const y = s.slice(g + 1).find((v) => !v.disabled && v[o]);
160
+ x = y && s.findIndex((v) => v[o] === y[o]);
161
+ } else if (l === w.up || l === w.left) {
218
162
  let y;
219
- if (r === I.down || r === I.right) {
220
- const v = o.slice(g + 1).find((m) => !m.disabled && m[i]);
221
- y = v && o.findIndex((m) => m[i] === v[i]);
222
- } else if (r === I.up || r === I.left) {
223
- let v;
224
- if (g === 0 && h)
225
- y = -1;
226
- else if (g === -1)
227
- v = o, y = o.findIndex((m) => !m.disabled && m[i]);
228
- else {
229
- v = o.slice(0, g);
230
- let m = v.pop();
231
- for (; m && m.disabled; )
232
- m = v.pop();
233
- y = m && o.findIndex((L) => L[i] === m[i]);
234
- }
235
- }
236
- if (y !== void 0) {
237
- const v = y - g;
238
- this.onNavigate(S, r, v);
239
- } else
240
- y === void 0 && o.findIndex((v) => v[i] === f[i]) === o.length - 1 && this.onNavigate(S, r);
241
- }
242
- else if (!c && p || w)
243
- this.onNavigate(S, r);
244
- else if (i) {
245
- let y;
246
- if (r === I.down || r === I.right) {
247
- const v = o.slice(g + 1).find((m) => !m.disabled && m[i]);
248
- y = v && o.findIndex((m) => m[i] === v[i]);
249
- } else if (r === I.up || r === I.left) {
250
- let v;
251
- if (g === 0 && h)
252
- y = -1;
163
+ if (g === 0 && c)
164
+ x = -1;
253
165
  else if (g === -1)
254
- v = o, y = o.find((m) => !m.disabled && m[i]);
166
+ y = s, x = s.findIndex((v) => !v.disabled && v[o]);
255
167
  else {
256
- v = o.slice(0, g);
257
- let m = v.pop();
258
- for (; m && m.disabled; )
259
- m = v.pop();
260
- y = m && o.findIndex((L) => L[i] === m[i]);
168
+ y = s.slice(0, g);
169
+ let v = y.pop();
170
+ for (; v && v.disabled; )
171
+ v = y.pop();
172
+ x = v && s.findIndex((be) => be[o] === v[o]);
261
173
  }
262
174
  }
263
- if (y !== void 0) {
264
- const v = y - g;
265
- this.onNavigate(S, r, v);
175
+ if (x !== void 0) {
176
+ const y = x - g;
177
+ A(D, l, y);
266
178
  } else
267
- y === void 0 && o.findIndex((v) => v[i] === f[i]) === o.length - 1 && this.onNavigate(S, r);
179
+ x === void 0 && s.findIndex((y) => y[o] === S[o]) === s.length - 1 && A(D, l);
180
+ }
181
+ else if (!p && h || T)
182
+ A(D, l);
183
+ else if (o) {
184
+ let x;
185
+ if (l === w.down || l === w.right) {
186
+ const y = s.slice(g + 1).find((v) => !v.disabled && v[o]);
187
+ x = y && s.findIndex((v) => v[o] === y[o]);
188
+ } else if (l === w.up || l === w.left) {
189
+ let y;
190
+ if (g === 0 && c)
191
+ x = -1;
192
+ else if (g === -1)
193
+ y = s, x = s.find((v) => !v.disabled && v[o]);
194
+ else {
195
+ y = s.slice(0, g);
196
+ let v = y.pop();
197
+ for (; v && v.disabled; )
198
+ v = y.pop();
199
+ x = v && s.findIndex((be) => be[o] === v[o]);
200
+ }
201
+ }
202
+ if (x !== void 0) {
203
+ const y = x - g;
204
+ A(D, l, y);
268
205
  } else
269
- this.onNavigate(S, r);
270
- e.preventDefault();
271
- }
272
- this.applyState(S);
206
+ x === void 0 && s.findIndex((y) => y[o] === S[o]) === s.length - 1 && A(D, l);
207
+ } else
208
+ A(D, l);
209
+ e.preventDefault();
273
210
  }
274
- }, this.handleItemClick = (e, t) => {
275
- this.base.handleItemClick(e, t), this._valueDuringOnChange = void 0;
276
- }, this.handleFocus = (e) => {
277
- this._skipFocusEvent || this.base.handleFocus(e);
278
- }, this.handleBlur = (e) => {
279
- if (this._skipFocusEvent || !this.state.focused)
280
- return;
281
- const t = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { adaptive: a } = this.props, { windowWidth: h = 0 } = this.state, n = h <= j && a, l = this.base.initState();
282
- l.syntheticEvent = e, l.data.focused = !1, l.events.push({ type: "onBlur" }), t && this.resetValueIfDisabledItem(), t && !n && this.base.togglePopup(l), this.applyState(l);
283
- }, this.handleDefaultItemClick = (e) => {
284
- const t = this.base.initState();
285
- t.syntheticEvent = e, this.base.togglePopup(t), this.triggerOnChange(this.props.defaultItem, t), this.applyState(t);
286
- }, this.handleWrapperClick = (e) => {
287
- if (e.isPropagationStopped())
288
- return;
289
- const t = this.base.initState();
290
- t.syntheticEvent = e, this.state.focused || (t.data.focused = !0), this.resetValueIfDisabledItem(), this.base.togglePopup(t), this.applyState(t);
291
- }, this.handleKeyPress = (e) => {
292
- if (this.props.filterable || e.which === 0 || e.keyCode === I.enter)
293
- return;
294
- let t = String.fromCharCode(e.charCode || e.keyCode);
295
- this.props.ignoreCase && (t = t.toLowerCase()), t === " " && e.preventDefault(), this.searchState = {
296
- word: this.searchState.word + t,
297
- last: this.searchState.last + t
298
- }, this.search(e);
299
- }, this.handleListFilterChange = (e) => {
300
- const t = this.base.initState();
301
- t.syntheticEvent = e.syntheticEvent, this.props.filter === void 0 && (t.data.text = e.target.value), this.base.filterChanged(e.target.value, t), this._lastKeypressIsFilter = !0, this.applyState(t), this.setState({ group: void 0 });
302
- }, this.onPopupOpened = () => {
303
- this._filterInput && this.focusElement(this._filterInput), this.props.adaptive && setTimeout(() => {
304
- this._filterInput && this.focusElement(this._filterInput);
305
- }, 300);
306
- }, this.onPopupClosed = () => {
307
- this.state.focused && window.setTimeout(() => {
308
- this.state.focused && this.base.wrapper && this.focusElement(this.base.wrapper);
309
- });
310
- }, this.onPopupMouseDown = (e) => {
311
- var t;
312
- (t = this.props.popupSettings) != null && t.onMouseDownOutside && this.props.popupSettings.onMouseDownOutside.call(void 0, e);
313
- }, this.togglePopup = () => {
314
- const e = this.base.initState();
315
- e.data.opened = this.state.opened, this.base.togglePopup(e), this.applyState(e);
316
- }, this.setValidity = () => {
317
- this._select && this._select.setCustomValidity && this._select.setCustomValidity(
318
- this.validity.valid ? "" : this.props.validationMessage || Ce
319
- );
320
- }, ee(be);
321
- }
322
- get _inputId() {
323
- return this.props.id + "-accessibility-id";
324
- }
325
- get _listboxId() {
326
- return this.props.id + "-listbox-id";
327
- }
328
- get _guid() {
329
- return this.props.id + "-guid";
330
- }
331
- get document() {
332
- if (B)
333
- return this.element && this.element.ownerDocument || document;
334
- }
335
- /**
336
- * @hidden
337
- */
338
- get element() {
339
- return this._element;
340
- }
341
- /**
342
- * The value of the DropDownList.
343
- */
344
- get value() {
345
- let s;
346
- 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), !U(s) && this.props.defaultItem !== void 0 && (s = this.props.defaultItem), s;
347
- }
348
- /**
349
- * The index of the selected item.
350
- */
351
- get index() {
352
- const { dataItemKey: s } = this.props, e = E(this.props), t = this.value;
353
- return e.findIndex((a) => k(a, t, s));
354
- }
355
- /**
356
- * Gets the `name` property of the DropDownList.
357
- */
358
- get name() {
359
- return this.props.name;
360
- }
361
- /**
362
- * Represents the validity state into which the DropDownList is set.
363
- */
364
- get validity() {
365
- const s = this.props.validationMessage !== void 0, e = !this.required || this.value !== null && this.value !== "" && this.value !== void 0, t = this.props.valid !== void 0 ? this.props.valid : e;
366
- return {
367
- customError: s,
368
- valid: t,
369
- valueMissing: this.value === null
370
- };
371
- }
372
- get validityStyles() {
373
- return this.props.validityStyles !== void 0 ? this.props.validityStyles : N.defaultProps.validityStyles;
374
- }
375
- /**
376
- * @hidden
377
- */
378
- get required() {
379
- return this.props.required !== void 0 ? this.props.required : N.defaultProps.required;
380
- }
381
- /**
382
- * @hidden
383
- */
384
- componentDidUpdate(s, e) {
385
- var o;
386
- const { dataItemKey: t, virtual: a, groupField: h = "", textField: n } = this.props, l = E(this.props), b = s.virtual ? s.virtual.total : 0, d = this.props.opened !== void 0 ? this.props.opened : this.state.opened, i = s.opened !== void 0 ? s.opened : e.opened, c = !i && d;
387
- if (this.base.didUpdate(), this.base.getPopupSettings().animate || c && this.onPopupOpened(), a && a.total !== b)
388
- this.base.vs.calcScrollElementHeight(), this.base.vs.reset();
389
- else {
390
- const f = this.value, g = s.value !== void 0 ? s.value : e.value;
391
- let p = l.findIndex((w) => k(w, f, t));
392
- h !== "" && f && n && (p = (o = this.base.getGroupedDataModernMode(l, h)) == null ? void 0 : o.map((w) => w[n]).indexOf(f[n]));
393
- const r = !k(g, f, t);
394
- c && a ? this.base.scrollToVirtualItem(a, p) : c && !a ? (this.onPopupOpened(), l && l.length !== 0 && this.base.resetGroupStickyHeader(l[0][h], this), this.base.scrollToItem(p)) : d && i && f && r && !this._navigated ? this.base.scrollToItem(p, this.base.vs.enabled) : d && 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());
211
+ K(D);
395
212
  }
396
- this._navigated = !1, this.setValidity();
397
- }
398
- /**
399
- * @hidden
400
- */
401
- componentDidMount() {
402
- var s;
403
- this.observerResize = B && 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);
404
- }
405
- /** @hidden */
406
- componentWillUnmount() {
407
- var s;
408
- (s = this.document) != null && s.body && this.observerResize && this.observerResize.disconnect();
409
- }
410
- /**
411
- * @hidden
412
- */
413
- render() {
414
- const s = Ie(this).toLanguageString(
415
- Y,
416
- ye[Y]
417
- ), { style: e, className: t, label: a, dir: h, virtual: n, size: l, rounded: b, fillMode: d, adaptive: i, unstyled: c } = this.props, { windowWidth: o = 0 } = this.state, f = this.props.opened !== void 0 ? this.props.opened : this.state.opened, g = this.value, p = T(g, this.props.textField), r = !this.validityStyles || this.validity.valid, w = this.base, F = w.vs, M = o <= j && i, _ = c && c.uDropDownList;
418
- F.enabled = n !== void 0, n !== void 0 && (w.vs.skip = n.skip, w.vs.total = n.total, w.vs.pageSize = n.pageSize);
419
- const { dataItemKey: z, disabled: P, tabIndex: S, loading: y, iconClassName: v, svgIcon: m, valueRender: L } = this.props, J = E(this.props), { focused: Q } = this.state, X = J.findIndex((O) => k(O, g, z)), H = /* @__PURE__ */ u.createElement("span", { id: this._inputId, className: x(D.inputInner({ c: _ })) }, p && /* @__PURE__ */ u.createElement("span", { className: x(D.inputText({ c: _ })) }, p)), Z = L !== void 0 ? L.call(void 0, H, g) : H, V = /* @__PURE__ */ u.createElement(u.Fragment, null, /* @__PURE__ */ u.createElement(
420
- "span",
213
+ }, wt = (e) => {
214
+ const n = t.current.initState();
215
+ n.syntheticEvent = e.syntheticEvent, r.filter === void 0 && (n.data.text = e.target.value), t.current.filterChanged(e.target.value, n), Ee.current = !0, K(n), Y({ group: void 0, text: String(e.target.value) });
216
+ }, ze = () => {
217
+ const e = r.filter !== void 0 ? r.filter : m.text;
218
+ return r.filterable && /* @__PURE__ */ i.createElement(
219
+ on,
421
220
  {
422
- ref: this.componentRef,
423
- className: x(
424
- D.wrapper({
425
- c: _,
426
- size: l,
427
- rounded: b,
428
- fillMode: d,
429
- focused: Q,
430
- disabled: P,
431
- invalid: !r,
432
- loading: y,
433
- required: this.required
434
- }),
435
- t
436
- ),
437
- style: a ? { ...e, width: void 0 } : e,
438
- dir: h,
439
- onMouseDown: f ? (O) => {
440
- O.target.nodeName !== "INPUT" && (this.focusElement(this.base.wrapper), O.preventDefault());
441
- } : void 0,
442
- onFocus: this.handleFocus,
443
- onBlur: this.handleBlur,
444
- tabIndex: se(S, P),
445
- accessKey: this.props.accessKey,
446
- onKeyDown: this.handleKeyDown,
447
- onKeyPress: this.handleKeyPress,
448
- onClick: P ? void 0 : this.handleWrapperClick,
449
- role: "combobox",
450
- "aria-required": this.required,
451
- "aria-disabled": P || void 0,
452
- "aria-haspopup": "listbox",
453
- "aria-expanded": f || !1,
454
- "aria-owns": this._listboxId,
455
- "aria-activedescendant": f ? "option-" + this._guid + "-" + (X + (n ? n.skip : 0)) : void 0,
456
- "aria-label": this.props.ariaLabel || this.props.label,
457
- "aria-labelledby": this.props.ariaLabelledBy,
458
- "aria-describedby": this.props.ariaDescribedBy || this._inputId,
459
- "aria-controls": this._listboxId,
460
- id: this.props.id,
461
- title: this.props.title
462
- },
463
- Z,
464
- y && /* @__PURE__ */ u.createElement(ie, { className: x(D.loadingIcon({ c: _ })), name: "loading" }),
465
- /* @__PURE__ */ u.createElement(
466
- G,
467
- {
468
- tabIndex: -1,
469
- type: "button",
470
- "aria-label": s,
471
- size: l,
472
- fillMode: d,
473
- iconClass: v,
474
- className: x(D.inputButton({ c: _ })),
475
- rounded: null,
476
- themeColor: "base",
477
- icon: v ? void 0 : "caret-alt-down",
478
- svgIcon: m || de,
479
- onMouseDown: (O) => this.state.focused && O.preventDefault()
480
- }
481
- ),
482
- this.dummySelect(g),
483
- !M && this.renderListContainer()
484
- ), M && this.renderAdaptiveListContainer());
485
- return a ? /* @__PURE__ */ u.createElement(
486
- le,
221
+ value: e,
222
+ ref: (n) => Z.current = n && n.element,
223
+ onChange: wt,
224
+ onKeyDown: Oe,
225
+ size: Q,
226
+ rounded: Fe,
227
+ fillMode: Ie,
228
+ renderListFilterWrapper: !0
229
+ }
230
+ );
231
+ }, yt = (e) => {
232
+ var a;
233
+ const n = t.current.initState();
234
+ n.syntheticEvent = e, (a = t == null ? void 0 : t.current) == null || a.togglePopup(n), U(r.defaultItem, n), K(n);
235
+ }, Ae = () => {
236
+ const { textField: e, defaultItem: n, dataItemKey: a } = r, c = L();
237
+ return n !== void 0 && /* @__PURE__ */ i.createElement(
238
+ an,
487
239
  {
488
- label: a,
489
- editorValue: p,
490
- editorValid: r,
491
- editorDisabled: this.props.disabled,
492
- style: { width: e ? e.width : void 0 },
493
- children: V
240
+ defaultItem: n,
241
+ textField: e,
242
+ selected: N(c, n, a),
243
+ key: "defaultitemkey",
244
+ onClick: yt
494
245
  }
495
- ) : V;
496
- }
497
- /**
498
- * @hidden
499
- */
500
- onNavigate(s, e, t) {
501
- const { defaultItem: a, dataItemKey: h, virtual: n = { skip: 0, total: 0, pageSize: 0 } } = this.props, l = E(this.props), b = this.base.vs, d = this.value, i = l.findIndex((o) => k(o, d, h)), c = this.base.navigation.navigate({
502
- current: n.skip + i,
503
- max: (b.enabled ? n.total : l.length) - 1,
504
- min: a !== void 0 ? -1 : 0,
505
- keyCode: e,
506
- skipItems: t || void 0
507
- });
508
- c !== void 0 && this.handleItemSelect(c, s), this.applyState(s);
509
- }
510
- renderAdaptiveListContainer() {
511
- const { windowWidth: s = 0 } = this.state, { header: e, footer: t, size: a, adaptiveTitle: h, groupField: n, groupStickyHeaderItemRender: l, list: b, unstyled: d } = this.props, i = E(this.props), c = this.props.opened !== void 0 ? this.props.opened : this.state.opened, o = d && d.uDropDownList, f = d && d.uDropDownsActionSheet, g = {
246
+ );
247
+ }, St = (e, n) => {
248
+ var a;
249
+ (a = t == null ? void 0 : t.current) == null || a.handleItemClick(e, n), V.current = void 0;
250
+ }, Dt = (e) => {
251
+ const { vs: n, list: a } = t.current;
252
+ n.scrollHandler(e);
253
+ const { groupField: c } = r;
254
+ let d = P(E);
255
+ if (!(!c || !d.length) && c) {
256
+ const u = _e.current = _e.current || (n.enabled ? n.itemHeight : a ? a.children[0].offsetHeight : 0), f = e.target.scrollTop - n.skip * u;
257
+ d = t.current.getGroupedDataModernMode(d, c);
258
+ let o = d[0][c];
259
+ for (let p = 1; p < d.length && !(u * p > f); p++)
260
+ d[p] && d[p][c] && (o = d[p][c]);
261
+ o !== m.group && Y({ group: o });
262
+ }
263
+ }, Ve = () => {
264
+ var l;
265
+ const {
266
+ textField: e,
267
+ dataItemKey: n,
268
+ virtual: a = { skip: 0, total: void 0 },
269
+ groupHeaderItemRender: c,
270
+ listNoDataRender: d,
271
+ itemRender: u
272
+ } = r, I = P(E), f = F && F.uDropDownList, o = t.current.vs, p = a.skip, s = r.opened !== void 0 ? r.opened : m.opened, S = t.current.getPopupSettings(), g = `translateY(${o.translate}px)`, h = L();
273
+ return /* @__PURE__ */ i.createElement(
274
+ ln,
275
+ {
276
+ id: ke,
277
+ show: s,
278
+ data: I.slice(),
279
+ focusedIndex: De(),
280
+ value: h,
281
+ textField: e,
282
+ valueField: n,
283
+ optionsGuid: qe,
284
+ groupField: r.groupField,
285
+ groupMode: "modern",
286
+ listRef: (T) => o.list = t.current.list = T,
287
+ wrapperStyle: { maxHeight: S.height },
288
+ wrapperCssClass: C(M.listContent({ c: f })),
289
+ listStyle: o.enabled ? { transform: g } : void 0,
290
+ key: "listkey",
291
+ skip: p,
292
+ onClick: St,
293
+ itemRender: u,
294
+ groupHeaderItemRender: c,
295
+ noDataRender: d,
296
+ onScroll: Dt,
297
+ wrapperRef: o.scrollerRef,
298
+ scroller: (l = t == null ? void 0 : t.current) == null ? void 0 : l.renderScrollElement(),
299
+ ariaSetSize: a.total
300
+ }
301
+ );
302
+ }, xt = () => {
303
+ var h;
304
+ const { windowWidth: e = 0 } = m, { header: n, footer: a, adaptiveTitle: c, groupField: d, groupStickyHeaderItemRender: u, list: I } = r, f = P(E), o = r.opened !== void 0 ? r.opened : m.opened, p = F && F.uDropDownList, s = F && F.uDropDownsActionSheet, S = {
512
305
  navigatable: !1,
513
306
  navigatableElements: [],
514
- expand: c,
307
+ expand: o,
515
308
  animation: !0,
516
- onClose: (r) => this.handleWrapperClick(r),
517
- animationStyles: s <= $ ? { top: 0, width: "100%", height: "100%" } : void 0,
518
- className: x(
519
- K.wrapper({
520
- c: f,
521
- isFullScreen: s <= $
309
+ onClose: (l) => Ce(l),
310
+ animationStyles: e <= lt ? { top: 0, width: "100%", height: "100%" } : void 0,
311
+ className: C(
312
+ J.wrapper({
313
+ c: s,
314
+ isFullScreen: e <= lt
522
315
  })
523
316
  )
524
317
  };
525
- let { group: p } = this.state;
526
- return p === void 0 && n !== void 0 && (p = T(i[0], n)), /* @__PURE__ */ u.createElement(we, { ...g }, /* @__PURE__ */ u.createElement(Se, { className: x(K.header({ c: f })) }, /* @__PURE__ */ u.createElement("div", { className: x(K.titleBar({ c: f })) }, /* @__PURE__ */ u.createElement("div", { className: x(K.title({ c: f })) }, /* @__PURE__ */ u.createElement("div", null, h)), /* @__PURE__ */ u.createElement("div", { className: x(K.actions({ c: f })) }, /* @__PURE__ */ u.createElement(
527
- G,
318
+ let { group: g } = m;
319
+ return g === void 0 && d !== void 0 && (g = fe(f[0], d)), /* @__PURE__ */ i.createElement(fn, { ...S }, /* @__PURE__ */ i.createElement(gn, { className: C(J.header({ c: s })) }, /* @__PURE__ */ i.createElement("div", { className: C(J.titleBar({ c: s })) }, /* @__PURE__ */ i.createElement("div", { className: C(J.title({ c: s })) }, /* @__PURE__ */ i.createElement("div", null, c)), /* @__PURE__ */ i.createElement("div", { className: C(J.actions({ c: s })) }, /* @__PURE__ */ i.createElement(
320
+ it,
528
321
  {
529
322
  tabIndex: 0,
530
323
  "aria-label": "Cancel",
531
324
  "aria-disabled": "false",
532
325
  type: "button",
533
326
  fillMode: "flat",
534
- onClick: this.handleWrapperClick,
327
+ onClick: Ce,
535
328
  icon: "x",
536
- svgIcon: pe
329
+ svgIcon: nn
537
330
  }
538
- ))), /* @__PURE__ */ u.createElement("div", { className: x(K.titleBarGroup({ c: f })) }, this.renderListFilter())), /* @__PURE__ */ u.createElement(xe, { overflowHidden: !0 }, e && /* @__PURE__ */ u.createElement("div", { className: x(D.listHeader({ c: o })) }, e), /* @__PURE__ */ u.createElement(
331
+ ))), /* @__PURE__ */ i.createElement("div", { className: C(J.titleBarGroup({ c: s })) }, ze())), /* @__PURE__ */ i.createElement(vn, { overflowHidden: !0 }, n && /* @__PURE__ */ i.createElement("div", { className: C(M.listHeader({ c: p })) }, n), /* @__PURE__ */ i.createElement(
539
332
  "div",
540
333
  {
541
- className: x(
542
- D.list({
543
- c: o,
544
- size: a,
545
- virtual: this.base.vs.enabled
334
+ className: C(
335
+ M.list({
336
+ c: p,
337
+ size: Q,
338
+ virtual: (h = t == null ? void 0 : t.current) == null ? void 0 : h.vs.enabled
546
339
  })
547
340
  )
548
341
  },
549
- this.renderDefaultItem(),
550
- !b && p && i.length !== 0 && /* @__PURE__ */ u.createElement(
551
- W,
342
+ Ae(),
343
+ !I && g && f.length !== 0 && /* @__PURE__ */ i.createElement(
344
+ nt,
552
345
  {
553
- group: p,
346
+ group: g,
554
347
  groupMode: "modern",
555
- render: l
348
+ render: u
556
349
  }
557
350
  ),
558
- this.renderList()
559
- ), t && /* @__PURE__ */ u.createElement("div", { className: x(D.listFooter({ c: o })) }, t)));
560
- }
561
- getFocusedIndex() {
562
- const s = this.value, {
563
- textField: e,
564
- dataItemKey: t,
565
- virtual: a = { skip: 0 },
566
- focusedItemIndex: h = ve,
567
- filterable: n,
568
- skipDisabledItems: l = !0
569
- } = this.props, b = E(this.props), d = this.props.filter ? this.props.filter : this.state.text;
570
- return l && e && !d && !s ? b.findIndex((i) => !i.disabled && i[e]) : U(s) && d === void 0 || n && d === "" ? b.findIndex((i) => k(i, s, t)) : d ? this._lastKeypressIsFilter ? h(b, d, e) : b.findIndex((i) => k(i, s, t)) : a.skip === 0 ? 0 : -1;
571
- }
572
- focusElement(s) {
573
- this._skipFocusEvent = !0, s.focus(), window.setTimeout(() => this._skipFocusEvent = !1, 30);
574
- }
575
- triggerOnChange(s, e) {
576
- k(this.value, s, this.props.dataItemKey) || (this.props.value === void 0 && (e.data.value = s), this._valueDuringOnChange = s, e.events.push({ type: "onChange" }));
577
- }
578
- applyState(s) {
579
- this.base.applyState(s), this._valueDuringOnChange = void 0;
580
- }
581
- calculateMedia(s) {
582
- for (const e of s)
583
- this.setState({ windowWidth: e.target.clientWidth });
584
- }
585
- resetValueIfDisabledItem() {
586
- const s = E(this.props), e = this.base.initState(), t = this.getFocusedIndex();
587
- this.haveFocusedItemAndDataNotEmpty(s, t) && (this.triggerOnChange(null, e), this.applyState(e));
588
- }
589
- haveFocusedItemAndDataNotEmpty(s, e) {
590
- return e !== void 0 && e !== -1 && s && s.length > 0 && s[e].disabled;
591
- }
351
+ Ve()
352
+ ), a && /* @__PURE__ */ i.createElement("div", { className: C(M.listFooter({ c: p })) }, a)));
353
+ }, Ct = () => {
354
+ m.focused && window.setTimeout(() => {
355
+ m.focused && t.current.wrapper && ne(t.current.wrapper);
356
+ });
357
+ }, Et = (e) => {
358
+ var n;
359
+ (n = r.popupSettings) != null && n.onMouseDownOutside && r.popupSettings.onMouseDownOutside.call(void 0, e);
360
+ }, kt = () => {
361
+ const { header: e, footer: n, dir: a, groupField: c, groupStickyHeaderItemRender: d, list: u } = r, I = P(E), f = t.current, o = f.getPopupSettings(), p = r.opened !== void 0 ? r.opened : m.opened, s = o.width !== void 0 ? o.width : f.popupWidth, S = F && F.uDropDownList, g = {
362
+ dir: a !== void 0 ? a : f.dirCalculated,
363
+ width: s,
364
+ popupSettings: {
365
+ ...o,
366
+ popupClass: C(
367
+ o.popupClass,
368
+ M.listContainer({
369
+ c: S
370
+ })
371
+ ),
372
+ anchor: o.anchor || q.current,
373
+ show: p,
374
+ onOpen: Se,
375
+ onClose: Ct,
376
+ onMouseDownOutside: Et
377
+ },
378
+ itemsCount: [I.length]
379
+ };
380
+ let { group: h } = m;
381
+ return h === void 0 && c !== void 0 && (h = fe(I[0], c)), /* @__PURE__ */ i.createElement(rn, { ...g }, ze(), e && /* @__PURE__ */ i.createElement("div", { className: C(M.listHeader({ c: S })) }, e), /* @__PURE__ */ i.createElement(
382
+ "div",
383
+ {
384
+ className: C(
385
+ M.list({
386
+ c: S,
387
+ size: Q,
388
+ virtual: t.current.vs.enabled
389
+ })
390
+ )
391
+ },
392
+ Ae(),
393
+ !u && h && I.length !== 0 && /* @__PURE__ */ i.createElement(nt, { group: h, groupMode: "modern", render: d }),
394
+ Ve()
395
+ ), n && /* @__PURE__ */ i.createElement("div", { className: C(M.listFooter({ c: S })) }, n));
396
+ }, Lt = (e) => {
397
+ const { dataItemKey: n } = r, a = P(E), c = L();
398
+ let d = a.map((b, $) => ({ item: b, itemIndex: $ }));
399
+ const u = G.current.word, I = G.current.last, f = dn(u, I);
400
+ let o = d.length, p = Math.max(
401
+ 0,
402
+ a.findIndex((b) => N(b, c, n))
403
+ ), s;
404
+ r.defaultItem && (s = { item: r.defaultItem, itemIndex: -1 }, o += 1, p += 1), p += f ? 1 : 0, d = cn(d, p, s);
405
+ let S, g, h, l = 0;
406
+ const { textField: T } = r;
407
+ for (; l < o; l++)
408
+ if (S = fe(d[l].item, T), g = f && ot(S, I, ve), h = ot(S, u, ve), g || h) {
409
+ l = d[l].itemIndex;
410
+ break;
411
+ }
412
+ if (l !== o) {
413
+ const b = t.current.initState();
414
+ b.syntheticEvent = e, X(l, b), K(b), V.current = void 0;
415
+ }
416
+ }, Mt = (e) => {
417
+ clearTimeout(Be.current), r.filterable || (Be.current = window.setTimeout(() => G.current.word = "", ut), Lt(e));
418
+ }, Pt = (e) => {
419
+ oe.current || t.current.handleFocus(e);
420
+ }, bt = (e) => {
421
+ if (oe.current || !m.focused)
422
+ return;
423
+ const n = r.opened !== void 0 ? r.opened : m.opened, { adaptive: a } = r, { windowWidth: c = 0 } = m, d = c <= st && a, u = t.current.initState();
424
+ u.syntheticEvent = e, u.data.focused = !1, u.events.push({ type: "onBlur" }), n && xe(), n && !d && t.current.togglePopup(u), K(u);
425
+ }, Nt = (e) => {
426
+ if (r.filterable || e.which === 0 || e.keyCode === w.enter)
427
+ return;
428
+ let n = String.fromCharCode(e.charCode || e.keyCode);
429
+ ve && (n = n.toLowerCase()), n === " " && e.preventDefault(), G.current = {
430
+ word: G.current.word + n,
431
+ last: G.current.last + n
432
+ }, Mt(e);
433
+ }, Ft = () => {
434
+ const e = t.current.initState();
435
+ e.data.opened = m.opened, t.current.togglePopup(e), K(e);
436
+ }, He = i.useRef(null), q = i.useRef(null), re = i.useRef(), Z = i.useRef(null);
437
+ i.useImperativeHandle(
438
+ He,
439
+ () => ({
440
+ get element() {
441
+ return q.current;
442
+ },
443
+ get index() {
444
+ return ft();
445
+ },
446
+ get name() {
447
+ return r.name;
448
+ },
449
+ get validity() {
450
+ return ye();
451
+ },
452
+ get value() {
453
+ return L();
454
+ },
455
+ focus: mt,
456
+ props: r,
457
+ togglePopup: Ft
458
+ })
459
+ ), i.useImperativeHandle(
460
+ ct,
461
+ () => He.current
462
+ );
463
+ const Be = i.useRef(null), G = i.useRef({ word: "", last: "" }), oe = i.useRef(!1), V = i.useRef(null), H = i.useRef(!1), Ee = i.useRef(!1), B = i.useRef({}), ie = i.useRef({}), t = i.useRef(
464
+ new dt({
465
+ props: E,
466
+ setState: () => {
467
+ },
468
+ state: {},
469
+ forceUpdate: () => {
470
+ },
471
+ element: null,
472
+ value: null,
473
+ handleItemSelect: () => {
474
+ }
475
+ })
476
+ ), _e = i.useRef(0), R = i.useRef(null), [m, Kt] = i.useState({}), [, We] = i.useReducer((e) => e, !0), Tt = pn(), Y = (e) => {
477
+ Kt({ ...m, ...e });
478
+ };
479
+ i.useEffect(() => {
480
+ t.current.updateComponentArgs({
481
+ props: E,
482
+ setState: Y,
483
+ state: m,
484
+ forceUpdate: We,
485
+ element: q.current,
486
+ handleItemSelect: X,
487
+ value: L()
488
+ });
489
+ }, [Y, m, We, X, L]), i.useEffect(() => {
490
+ var p, s, S, g, h, l, T, b, $, te, ce, ue, D;
491
+ const { dataItemKey: e, virtual: n, groupField: a = "", textField: c } = r, d = P(E), u = B.current.virtual ? B.current.virtual.total : 0, I = r.opened !== void 0 ? r.opened : m.opened, f = B.current.opened !== void 0 ? B.current.opened : ie.current.opened, o = !f && I;
492
+ if ((p = t == null ? void 0 : t.current) == null || p.didUpdate(), (s = t == null ? void 0 : t.current) != null && s.getPopupSettings().animate || o && Se(), n && n.total !== u)
493
+ (S = t == null ? void 0 : t.current) == null || S.vs.calcScrollElementHeight(), (g = t == null ? void 0 : t.current) == null || g.vs.reset();
494
+ else {
495
+ const z = L(), pe = B.current.value !== void 0 ? B.current.value : ie.current.value;
496
+ let W = d.findIndex((j) => N(j, z, e));
497
+ a !== "" && z && c && (W = (l = (h = t == null ? void 0 : t.current) == null ? void 0 : h.getGroupedDataModernMode(d, a)) == null ? void 0 : l.map((j) => j[c]).indexOf(z[c]));
498
+ const me = !N(pe, z, e);
499
+ o && n ? (T = t == null ? void 0 : t.current) == null || T.scrollToVirtualItem(n, W) : o && !n ? (Se(), d && d.length !== 0 && ((b = t == null ? void 0 : t.current) == null || b.resetGroupStickyHeader(d[0][a], {
500
+ setState: Y,
501
+ group: m.group,
502
+ state: m
503
+ })), ($ = t == null ? void 0 : t.current) == null || $.scrollToItem(W)) : I && f && z && me && !H.current ? (ce = t == null ? void 0 : t.current) == null || ce.scrollToItem(W, (te = t == null ? void 0 : t.current) == null ? void 0 : te.vs.enabled) : I && f && H.current && (H.current && n && n.skip === 0 ? (ue = t == null ? void 0 : t.current) == null || ue.vs.reset() : H.current && n && n.skip === n.total - n.pageSize && ((D = t == null ? void 0 : t.current) == null || D.vs.scrollToEnd()));
504
+ }
505
+ H.current = !1, ie.current = m, B.current = r, Ke();
506
+ }), i.useEffect(() => {
507
+ var e, n;
508
+ return R.current = tt && window.ResizeObserver && new window.ResizeObserver((a) => vt(a)), (e = t == null ? void 0 : t.current) == null || e.didMount(), Ke(), (n = he()) != null && n.body && R.current && R.current.observe(he().body), () => {
509
+ var a;
510
+ (a = he()) != null && a.body && R.current && R.current.disconnect();
511
+ };
512
+ }, []);
513
+ const Ue = ge + "-accessibility-id", ke = ge + "-listbox-id", qe = ge + "-guid", Ot = Tt.toLanguageString(
514
+ at,
515
+ mn[at]
516
+ ), {
517
+ style: ae,
518
+ className: zt,
519
+ label: Le,
520
+ dir: At,
521
+ virtual: _,
522
+ adaptive: Vt,
523
+ dataItemKey: Ht,
524
+ disabled: le,
525
+ loading: Ge,
526
+ iconClassName: Ye,
527
+ svgIcon: $e,
528
+ valueRender: je
529
+ } = r, { windowWidth: Bt = 0 } = m, Me = r.opened !== void 0 ? r.opened : m.opened, se = L(), Pe = fe(se, r.textField), Je = !gt() || ye().valid, de = t.current, _t = de.vs, Qe = Bt <= st && Vt, ee = F && F.uDropDownList;
530
+ _t.enabled = _ !== void 0, _ !== void 0 && (de.vs.skip = _.skip, de.vs.total = _.total, de.vs.pageSize = _.pageSize);
531
+ const Wt = P(E), { focused: Ut } = m, qt = Wt.findIndex((e) => N(e, se, Ht)), Xe = /* @__PURE__ */ i.createElement("span", { id: Ue, className: C(M.inputInner({ c: ee })) }, Pe && /* @__PURE__ */ i.createElement("span", { className: C(M.inputText({ c: ee })) }, Pe)), Gt = je !== void 0 ? je.call(void 0, Xe, se) : Xe, Ze = /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(
532
+ "span",
533
+ {
534
+ ref: It,
535
+ className: C(
536
+ M.wrapper({
537
+ c: ee,
538
+ size: Q,
539
+ rounded: Fe,
540
+ fillMode: Ie,
541
+ focused: Ut,
542
+ disabled: le,
543
+ invalid: !Je,
544
+ loading: Ge,
545
+ required: we()
546
+ }),
547
+ zt
548
+ ),
549
+ style: Le ? { ...ae, width: void 0 } : ae,
550
+ dir: At,
551
+ onMouseDown: Me ? (e) => {
552
+ e.target.nodeName !== "INPUT" && (ne(t.current.wrapper), e.preventDefault());
553
+ } : void 0,
554
+ onFocus: Pt,
555
+ onBlur: bt,
556
+ tabIndex: Qt(pt, le),
557
+ accessKey: r.accessKey,
558
+ onKeyDown: Oe,
559
+ onKeyPress: Nt,
560
+ onClick: le ? void 0 : Ce,
561
+ role: "combobox",
562
+ "aria-required": we(),
563
+ "aria-disabled": le || void 0,
564
+ "aria-haspopup": "listbox",
565
+ "aria-expanded": Me || !1,
566
+ "aria-owns": ke,
567
+ "aria-activedescendant": Me ? "option-" + qe + "-" + (qt + (_ ? _.skip : 0)) : void 0,
568
+ "aria-label": r.ariaLabel || r.label,
569
+ "aria-labelledby": r.ariaLabelledBy,
570
+ "aria-describedby": r.ariaDescribedBy || Ue,
571
+ "aria-controls": ke,
572
+ id: r.id,
573
+ title: r.title
574
+ },
575
+ Gt,
576
+ Ge && /* @__PURE__ */ i.createElement(Xt, { className: C(M.loadingIcon({ c: ee })), name: "loading" }),
577
+ /* @__PURE__ */ i.createElement(
578
+ it,
579
+ {
580
+ tabIndex: -1,
581
+ type: "button",
582
+ "aria-label": Ot,
583
+ size: Q,
584
+ fillMode: Ie,
585
+ iconClass: Ye,
586
+ className: C(M.inputButton({ c: ee })),
587
+ rounded: null,
588
+ themeColor: "base",
589
+ icon: Ye ? void 0 : "caret-alt-down",
590
+ svgIcon: $e || tn,
591
+ onMouseDown: (e) => m.focused && e.preventDefault()
592
+ }
593
+ ),
594
+ ht(se),
595
+ !Qe && kt()
596
+ ), Qe && xt());
597
+ return Le ? /* @__PURE__ */ i.createElement(
598
+ en,
599
+ {
600
+ label: Le,
601
+ editorValue: Pe,
602
+ editorValid: Je,
603
+ editorDisabled: r.disabled,
604
+ style: { width: ae ? ae.width : void 0 },
605
+ children: Ze
606
+ }
607
+ ) : Ze;
608
+ });
609
+ Ne.propTypes = {
610
+ delay: k.number,
611
+ ignoreCase: k.bool,
612
+ iconClassName: k.string,
613
+ svgIcon: Zt,
614
+ defaultItem: k.any,
615
+ valueRender: k.func,
616
+ valueMap: k.func,
617
+ validationMessage: k.string,
618
+ required: k.bool,
619
+ id: k.string,
620
+ ariaLabelledBy: k.string,
621
+ ariaDescribedBy: k.string,
622
+ ariaLabel: k.string,
623
+ leftRightKeysNavigation: k.bool,
624
+ title: k.string,
625
+ groupField: k.string,
626
+ list: k.any,
627
+ skipDisabledItems: k.bool
592
628
  };
593
- N.displayName = "DropDownList", N.propTypes = {
594
- delay: C.number,
595
- ignoreCase: C.bool,
596
- iconClassName: C.string,
597
- svgIcon: te,
598
- defaultItem: C.any,
599
- valueRender: C.func,
600
- valueMap: C.func,
601
- validationMessage: C.string,
602
- required: C.bool,
603
- id: C.string,
604
- ariaLabelledBy: C.string,
605
- ariaDescribedBy: C.string,
606
- ariaLabel: C.string,
607
- leftRightKeysNavigation: C.bool,
608
- title: C.string,
609
- groupField: C.string,
610
- list: C.any,
611
- skipDisabledItems: C.bool,
612
- renderListFilterWrapper: C.bool,
613
- ...R.propTypes
614
- }, N.defaultProps = {
629
+ const O = {
615
630
  delay: 500,
616
631
  tabIndex: 0,
617
632
  ignoreCase: !0,
618
- ...R.defaultProps,
633
+ ...dt.defaultProps,
619
634
  required: !1,
620
635
  size: "medium",
621
636
  rounded: "medium",
622
637
  fillMode: "solid",
623
638
  groupMode: "modern"
624
639
  };
625
- let A = N;
626
- const De = ae(), Ee = oe(
627
- ne(
628
- De,
629
- re(A)
630
- )
631
- );
632
- Ee.displayName = "KendoReactDropDownList";
640
+ Ne.displayName = "KendoReactDropDownList";
641
+ const hn = Rt();
642
+ Ne.displayName = "KendoReactDropDownList";
633
643
  export {
634
- Ee as DropDownList,
635
- De as DropDownListPropsContext,
636
- A as DropDownListWithoutContext
644
+ Ne as DropDownList,
645
+ hn as DropDownListPropsContext,
646
+ O as dropDownListDefaultProps
637
647
  };