@progress/kendo-react-dropdowns 7.2.4-develop.3 → 7.3.0-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.
Files changed (107) hide show
  1. package/AutoComplete/AutoComplete.js +8 -0
  2. package/AutoComplete/AutoComplete.mjs +458 -0
  3. package/ComboBox/ComboBox.js +8 -0
  4. package/ComboBox/ComboBox.mjs +618 -0
  5. package/DropDownList/DropDownList.js +8 -0
  6. package/DropDownList/DropDownList.mjs +630 -0
  7. package/DropDownTree/DropDownTree.js +8 -0
  8. package/DropDownTree/DropDownTree.mjs +550 -0
  9. package/DropDownTree/ListNoData.js +8 -0
  10. package/DropDownTree/ListNoData.mjs +13 -0
  11. package/DropDownTree/useDropdownWidth.js +8 -0
  12. package/DropDownTree/useDropdownWidth.mjs +25 -0
  13. package/MultiColumnComboBox/MultiColumnComboBox.js +8 -0
  14. package/MultiColumnComboBox/MultiColumnComboBox.mjs +186 -0
  15. package/MultiSelect/MultiSelect.js +8 -0
  16. package/MultiSelect/MultiSelect.mjs +694 -0
  17. package/MultiSelect/TagList.js +8 -0
  18. package/MultiSelect/TagList.mjs +48 -0
  19. package/MultiSelectTree/MultiSelectTree.js +8 -0
  20. package/MultiSelectTree/MultiSelectTree.mjs +590 -0
  21. package/MultiSelectTree/utils.js +8 -0
  22. package/MultiSelectTree/utils.mjs +74 -0
  23. package/common/AdaptiveMode.js +8 -0
  24. package/common/AdaptiveMode.mjs +73 -0
  25. package/common/ClearButton.js +8 -0
  26. package/common/ClearButton.mjs +38 -0
  27. package/common/DropDownBase.js +8 -0
  28. package/common/DropDownBase.mjs +194 -0
  29. package/common/GroupStickyHeader.js +8 -0
  30. package/common/GroupStickyHeader.mjs +22 -0
  31. package/common/List.js +8 -0
  32. package/common/List.mjs +117 -0
  33. package/common/ListContainer.js +8 -0
  34. package/common/ListContainer.mjs +33 -0
  35. package/common/ListDefaultItem.js +8 -0
  36. package/common/ListDefaultItem.mjs +36 -0
  37. package/common/ListFilter.js +8 -0
  38. package/common/ListFilter.mjs +49 -0
  39. package/common/ListGroupItem.js +8 -0
  40. package/common/ListGroupItem.mjs +32 -0
  41. package/common/ListItem.js +8 -0
  42. package/common/ListItem.mjs +49 -0
  43. package/common/MultiColumnList.js +8 -0
  44. package/common/MultiColumnList.mjs +28 -0
  45. package/common/Navigation.js +8 -0
  46. package/common/Navigation.mjs +29 -0
  47. package/common/SearchBar.js +8 -0
  48. package/common/SearchBar.mjs +65 -0
  49. package/common/VirtualScroll.js +8 -0
  50. package/common/VirtualScroll.mjs +75 -0
  51. package/common/constants.js +8 -0
  52. package/common/constants.mjs +13 -0
  53. package/common/settings.js +8 -0
  54. package/common/settings.mjs +12 -0
  55. package/common/utils.js +8 -0
  56. package/common/utils.mjs +109 -0
  57. package/common/withCustomComponent.js +8 -0
  58. package/common/withCustomComponent.mjs +13 -0
  59. package/dist/cdn/js/kendo-react-dropdowns.js +8 -5
  60. package/index.d.mts +4098 -5
  61. package/index.d.ts +4098 -31
  62. package/index.js +8 -5
  63. package/index.mjs +55 -4429
  64. package/messages/index.js +8 -0
  65. package/messages/index.mjs +27 -0
  66. package/package-metadata.js +8 -0
  67. package/package-metadata.mjs +19 -0
  68. package/package.json +9 -9
  69. package/AutoComplete/AutoComplete.d.ts +0 -236
  70. package/AutoComplete/AutoCompleteProps.d.ts +0 -254
  71. package/ComboBox/ComboBox.d.ts +0 -254
  72. package/ComboBox/ComboBoxProps.d.ts +0 -324
  73. package/DropDownList/DropDownList.d.ts +0 -264
  74. package/DropDownList/DropDownListProps.d.ts +0 -329
  75. package/DropDownTree/DropDownTree.d.ts +0 -74
  76. package/DropDownTree/DropDownTreeProps.d.ts +0 -297
  77. package/DropDownTree/ListNoData.d.ts +0 -10
  78. package/DropDownTree/useDropdownWidth.d.ts +0 -10
  79. package/MultiColumnComboBox/MultiColumnComboBox.d.ts +0 -300
  80. package/MultiSelect/MultiSelect.d.ts +0 -262
  81. package/MultiSelect/MultiSelectProps.d.ts +0 -325
  82. package/MultiSelect/TagList.d.ts +0 -42
  83. package/MultiSelectTree/MultiSelectTree.d.ts +0 -85
  84. package/MultiSelectTree/MultiSelectTreeProps.d.ts +0 -324
  85. package/MultiSelectTree/utils.d.ts +0 -21
  86. package/common/AdaptiveMode.d.ts +0 -25
  87. package/common/ClearButton.d.ts +0 -18
  88. package/common/DropDownBase.d.ts +0 -180
  89. package/common/GroupStickyHeader.d.ts +0 -28
  90. package/common/List.d.ts +0 -50
  91. package/common/ListContainer.d.ts +0 -22
  92. package/common/ListDefaultItem.d.ts +0 -20
  93. package/common/ListFilter.d.ts +0 -23
  94. package/common/ListGroupItem.d.ts +0 -37
  95. package/common/ListItem.d.ts +0 -65
  96. package/common/MultiColumnList.d.ts +0 -9
  97. package/common/Navigation.d.ts +0 -17
  98. package/common/SearchBar.d.ts +0 -47
  99. package/common/VirtualScroll.d.ts +0 -45
  100. package/common/constants.d.ts +0 -8
  101. package/common/events.d.ts +0 -76
  102. package/common/filterDescriptor.d.ts +0 -45
  103. package/common/settings.d.ts +0 -109
  104. package/common/utils.d.ts +0 -70
  105. package/common/withCustomComponent.d.ts +0 -11
  106. package/messages/index.d.ts +0 -44
  107. package/package-metadata.d.ts +0 -9
package/index.mjs CHANGED
@@ -1,4432 +1,58 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
5
8
  "use client";
6
- import * as o from "react";
7
- import l from "prop-types";
8
- import { IconWrap as Ce, classNames as B, Keys as g, svgIconPropType as fs, createPropsContext as Be, withIdHOC as Et, withPropsContext as Dt, validatePackage as $e, canUseDOM as Me, getTabIndex as Gt, kendoThemeMaps as Ge, getActiveElement as ws, useCustomComponent as Es, usePropsContext as Ut, getScrollbarWidth as Ds, getter as Ct, setScrollbarWidth as Fs, useId as gs, useRtl as ms, noop as Fe, mapTree as Ts, extendDataItem as Ms } from "@progress/kendo-react-common";
9
- import { FloatingLabel as Ue } from "@progress/kendo-react-labels";
10
- import { searchIcon as Ns, caretAltDownIcon as jt, xIcon as at, plusIcon as Os } from "@progress/kendo-svg-icons";
11
- import { Popup as Yt, PopupPropsContext as Ps } from "@progress/kendo-react-popup";
12
- import { TextBox as _s, InputPrefix as Rs } from "@progress/kendo-react-inputs";
13
- import { provideLocalizationService as We, registerForLocalization as vs, useLocalization as bs } from "@progress/kendo-react-intl";
14
- import { Button as Te, Chip as Vs } from "@progress/kendo-react-buttons";
15
- import { ActionSheet as Jt, ActionSheetHeader as Qt, ActionSheetContent as lt, ActionSheetFooter as Bs } from "@progress/kendo-react-layout";
16
- import { TreeView as kt } from "@progress/kendo-react-treeview";
17
- class Ft extends o.Component {
18
- render() {
19
- const {
20
- children: t,
21
- width: e,
22
- dir: s,
23
- itemsCount: n,
24
- popupSettings: a
25
- } = this.props;
26
- return /* @__PURE__ */ o.createElement(
27
- Yt,
28
- {
29
- style: { width: e, direction: s },
30
- contentKey: n && n.join(),
31
- ...a
32
- },
33
- t
34
- );
35
- }
36
- }
37
- const Xt = o.forwardRef((i, t) => {
38
- const e = o.useRef(null);
39
- return o.useImperativeHandle(
40
- t,
41
- () => e.current
42
- ), /* @__PURE__ */ o.createElement("div", { className: "k-list-filter" }, /* @__PURE__ */ o.createElement(
43
- _s,
44
- {
45
- ...i,
46
- ref: e,
47
- value: i.value || "",
48
- onChange: i.onChange,
49
- onKeyDown: i.onKeyDown,
50
- tabIndex: i.tabIndex,
51
- onClick: (s) => s.stopPropagation(),
52
- size: i.size,
53
- fillMode: i.fillMode,
54
- rounded: i.rounded,
55
- prefix: () => /* @__PURE__ */ o.createElement(Rs, null, /* @__PURE__ */ o.createElement(Ce, { name: "search", icon: Ns }))
56
- }
57
- ));
58
- });
59
- Xt.propTypes = {
60
- value: l.oneOfType([l.string, l.number, l.array]),
61
- tabIndex: l.number,
62
- onChange: l.func,
63
- onKeyDown: l.func,
64
- size: l.oneOf([null, "small", "medium", "large"]),
65
- rounded: l.oneOf([null, "small", "medium", "large", "full"]),
66
- fillMode: l.oneOf([null, "solid", "flat", "outline"])
67
- };
68
- Xt.displayName = "KendoReactListFilter";
69
- const Re = Xt;
70
- class qe extends o.Component {
71
- render() {
72
- const {
73
- group: t,
74
- groupMode: e,
75
- render: s
76
- } = this.props, n = /* @__PURE__ */ o.createElement("div", { className: "k-list-group-sticky-header" }, e === "classic" ? t : /* @__PURE__ */ o.createElement("div", { className: "k-list-header-text" }, t));
77
- return s !== void 0 ? s.call(void 0, n, this.props) : n;
78
- }
79
- }
80
- const U = (i) => i != null, Ks = (i, t) => {
81
- for (let e = 0; e < i.length; e++)
82
- if (i.charAt(e) !== t)
83
- return !1;
84
- return !0;
85
- }, Ls = (i, t, e) => {
86
- let s = i;
87
- return e && (s = [e].concat(s)), s.slice(t).concat(s.slice(0, t));
88
- }, os = (i, t, e) => {
89
- if (!U(i))
90
- return !1;
91
- let s = String(i);
92
- return e && (s = s.toLowerCase()), s.indexOf(t) === 0;
93
- }, zs = (i, t, e, s, n) => {
94
- const a = i.offsetHeight, p = t.children.item(e), c = p.offsetTop + (n ? s - i.scrollTop : 0), d = p.offsetHeight;
95
- if (n) {
96
- let r = 0;
97
- c + d > a ? r = c + d - a : c < 0 && (r = c), r !== 0 ? i.scrollTop += r : i.scrollTop === 0 && s !== 0 && (i.scrollTop = s);
98
- } else
99
- c + d > a + i.scrollTop ? i.scrollTop = c + d - a : c < i.scrollTop && (i.scrollTop -= i.scrollTop - c);
100
- }, Ve = (i, t, e) => {
101
- let s = -1;
102
- if (t) {
103
- t = t.toLowerCase();
104
- for (let n = 0; n < i.length; n++) {
105
- const a = (V(i[n], e) || "") + "";
106
- if (a && a.toLowerCase().startsWith(t)) {
107
- s = n;
108
- break;
109
- }
110
- }
111
- }
112
- return s;
113
- }, Lt = (i, t, e, s = !1) => {
114
- const n = (a) => s ? a : a.toLowerCase();
115
- return i.findIndex((a) => e ? n(V(a, e)) === n(t) : n(t) === n(a.toString()));
116
- }, V = (i, t) => {
117
- if (t && U(i)) {
118
- const e = t.split(".");
119
- let s = i;
120
- return e.forEach((n) => {
121
- s = s ? s[n] : void 0;
122
- }), s;
123
- }
124
- return i;
125
- }, Wi = (i, t, e) => {
126
- if (!i)
127
- return;
128
- const s = i.findIndex((n) => V(n, t) === e);
129
- return i[s];
130
- }, Hs = (i = [], t = [], e) => {
131
- if (i === t)
132
- return !0;
133
- if (i.length !== t.length)
134
- return !1;
135
- for (let s = 0; s < i.length; s++)
136
- if (!R(i[s], t[s], e))
137
- return !1;
138
- return !0;
139
- }, bt = (i, t, e) => {
140
- t.forEach((s) => {
141
- const n = i.findIndex((a) => R(a, s, e));
142
- n !== -1 && i.splice(n, 1);
143
- });
144
- }, R = (i, t, e) => i === t || U(i) === U(t) && V(i, e) === V(t, e), as = (i, t, e) => {
145
- if (t) {
146
- const s = Lt(i, t, e, !0);
147
- return s !== -1 ? i[s] : i[Ve(i, t, e)];
148
- }
149
- return i[0];
150
- }, As = (i, t = [], e) => {
151
- let s = "";
152
- if (i) {
153
- const n = t[Ve(t, i, e)];
154
- if (n) {
155
- const a = V(n, e);
156
- i.toLowerCase() !== a.toLowerCase() && (s = a.substring(i.length));
157
- }
158
- }
159
- return s;
160
- }, Ws = (i) => {
161
- i.target.nodeName !== "INPUT" && i.preventDefault();
162
- }, St = (i, t, e) => !!i != !!t || i.text !== t.text ? !1 : i === t || Hs(i.data, t.data, e), qs = (i) => i.preventDefault();
163
- class $s extends o.Component {
164
- render() {
165
- const {
166
- selected: t,
167
- defaultItem: e,
168
- textField: s
169
- } = this.props;
170
- return /* @__PURE__ */ o.createElement(
171
- "div",
172
- {
173
- onClick: this.props.onClick,
174
- onMouseDown: qs,
175
- style: { position: "unset" },
176
- className: B("k-list-optionlabel", {
177
- "k-selected": t
178
- })
179
- },
180
- V(e, s) || ""
181
- );
182
- }
183
- }
184
- class Gs extends o.Component {
185
- constructor() {
186
- super(...arguments), this.handleClick = (t) => this.props.onClick(this.props.index, t);
187
- }
188
- render() {
189
- const {
190
- selected: t,
191
- group: e,
192
- dataItem: s,
193
- virtual: n,
194
- groupMode: a,
195
- disabled: p,
196
- render: c
197
- } = this.props, d = /* @__PURE__ */ o.createElement(
198
- "li",
199
- {
200
- id: this.props.id,
201
- role: "option",
202
- "aria-selected": t,
203
- "aria-disabled": p ? !0 : void 0,
204
- className: B("k-list-item", {
205
- "k-selected": t,
206
- "k-focus": this.props.focused,
207
- "k-first": !!e && a === "classic",
208
- "k-disabled": p
209
- }),
210
- onClick: this.handleClick,
211
- style: { position: n ? "relative" : "unset" }
212
- },
213
- /* @__PURE__ */ o.createElement("span", { className: "k-list-item-text" }, V(s, this.props.textField).toString()),
214
- e !== void 0 && a === "classic" ? /* @__PURE__ */ o.createElement("div", { className: "k-list-item-group-label" }, e) : null
215
- );
216
- return c !== void 0 ? c.call(void 0, d, this.props) : d;
217
- }
218
- }
219
- class Us extends o.Component {
220
- render() {
221
- const {
222
- group: t,
223
- virtual: e,
224
- render: s,
225
- isMultiColumn: n = !1
226
- } = this.props, a = /* @__PURE__ */ o.createElement(
227
- "li",
228
- {
229
- id: this.props.id,
230
- role: "group",
231
- className: n ? "k-table-group-row" : "k-list-group-item",
232
- style: n ? { boxSizing: "inherit" } : { position: e ? "relative" : "unset" }
233
- },
234
- /* @__PURE__ */ o.createElement("span", { className: s ? void 0 : n ? "k-table-th" : "k-list-item-text" }, t)
235
- );
236
- return s !== void 0 ? s.call(void 0, a, this.props) : a;
237
- }
238
- }
239
- const ve = "dropdowns.nodata", it = "dropdowns.clear", zt = "dropdowns.comboArrowBtnAriaLabelExpand", Ht = "dropdowns.comboArrowBtnAriaLabelCollapse", At = "dropdowns.dropDownListArrowBtnAriaLabel", nt = "dropdowns.apply", ot = "dropdowns.cancel", ce = {
240
- [it]: "clear",
241
- [ve]: "NO DATA FOUND.",
242
- [zt]: "expand combobox",
243
- [Ht]: "collapse combobox",
244
- [At]: "select",
245
- [nt]: "Apply",
246
- [ot]: "Cancel"
247
- };
248
- class je extends o.Component {
249
- renderItems() {
250
- const {
251
- textField: t,
252
- valueField: e,
253
- groupField: s,
254
- groupMode: n,
255
- isMultiColumn: a,
256
- optionsGuid: p,
257
- skip: c = 0,
258
- virtual: d,
259
- focusedIndex: r,
260
- highlightSelected: h = !0,
261
- value: u,
262
- data: f,
263
- itemRender: m,
264
- groupHeaderItemRender: v
265
- } = this.props, b = Array.isArray(u);
266
- let w = 0;
267
- return f.map((k, D) => {
268
- const O = c + D, N = c + D + w, _ = k.disabled ? !1 : h && (!b && R(k, u, e) || b && u.findIndex((E) => R(E, k, e)) !== -1);
269
- let S, F, C;
270
- return D > 0 && s !== void 0 && (F = V(k, s), C = V(f[D - 1], s), F && C && F !== C && (S = F)), S !== void 0 && n === "modern" && (w += 1), [
271
- S !== void 0 && n === "modern" && /* @__PURE__ */ o.createElement(
272
- Us,
273
- {
274
- id: `option-${p}-${N}`,
275
- virtual: d,
276
- key: O + "-group-item",
277
- group: S,
278
- isMultiColumn: a,
279
- render: v
280
- }
281
- ),
282
- /* @__PURE__ */ o.createElement(
283
- Gs,
284
- {
285
- id: `option-${p}-${S !== void 0 && n === "modern" ? N + 1 : N}`,
286
- virtual: d,
287
- dataItem: k,
288
- groupMode: n,
289
- selected: _,
290
- focused: r === D,
291
- index: O,
292
- key: O,
293
- onClick: this.props.onClick,
294
- textField: t,
295
- group: S,
296
- render: m,
297
- disabled: k.disabled
298
- }
299
- )
300
- ];
301
- });
302
- }
303
- renderNoValueElement(t) {
304
- const e = this.props.noDataRender, s = /* @__PURE__ */ o.createElement("div", { className: "k-nodata" }, /* @__PURE__ */ o.createElement("div", null, t.toLanguageString(ve, ce[ve])));
305
- return e ? e.call(void 0, s) : s;
306
- }
307
- render() {
308
- const t = We(this), {
309
- id: e,
310
- show: s,
311
- wrapperCssClass: n,
312
- wrapperStyle: a,
313
- listStyle: p,
314
- listRef: c,
315
- wrapperRef: d,
316
- listClassName: r = "k-list-ul",
317
- ariaSetSize: h
318
- } = this.props, u = this.renderItems();
319
- return u.length ? /* @__PURE__ */ o.createElement(
320
- "div",
321
- {
322
- className: n,
323
- style: a,
324
- ref: d,
325
- onMouseDown: this.props.onMouseDown,
326
- onBlur: this.props.onBlur,
327
- onScroll: this.props.onScroll,
328
- unselectable: "on"
329
- },
330
- /* @__PURE__ */ o.createElement(
331
- "ul",
332
- {
333
- id: e,
334
- role: "listbox",
335
- "aria-hidden": s ? void 0 : !0,
336
- "aria-setsize": h,
337
- className: r,
338
- ref: c,
339
- style: p
340
- },
341
- u
342
- ),
343
- this.props.scroller && /* @__PURE__ */ o.createElement("div", { className: "k-height-container" }, this.props.scroller)
344
- ) : this.renderNoValueElement(t);
345
- }
346
- }
347
- vs(je);
348
- const js = 1533915;
349
- class Ys {
350
- constructor() {
351
- this.container = null, this.scrollElement = null, this.list = null, this.containerHeight = 0, this.skip = 0, this.total = 0, this.enabled = !1, this.pageSize = 0, this.itemHeight = 0, this.PageChange = null, this.prevScrollPos = 0, this.listTranslate = 0, this.scrollSyncing = !1, this.scrollerRef = (t) => {
352
- const e = this;
353
- e.container = t, t && (t.setAttribute("unselectable", "on"), window.setTimeout(e.calcScrollElementHeight.bind(e), 0));
354
- }, this.calcScrollElementHeight = () => {
355
- this.scrollSyncing = !0;
356
- let t = !1;
357
- this.itemHeight = this.list ? this.list.children[0].offsetHeight : this.itemHeight, this.containerHeight = Math.min(js, this.itemHeight * this.total);
358
- const e = this.containerHeight;
359
- return this.scrollElement && (t = this.scrollElement.style.height !== e + "px", t && (this.scrollElement.style.height = e + "px")), this.scrollSyncing = !1, t;
360
- }, this.scrollHandler = this.scrollHandler.bind(this);
361
- }
362
- get translate() {
363
- return this.listTranslate;
364
- }
365
- changePage(t, e) {
366
- const s = Math.min(Math.max(0, t), this.total - this.pageSize);
367
- s !== this.skip && this.PageChange && this.PageChange({ skip: s, take: this.pageSize }, e);
368
- }
369
- translateTo(t) {
370
- this.listTranslate = t, this.list && (this.list.style.transform = "translateY(" + t + "px)");
371
- }
372
- reset() {
373
- this.container && (this.calcScrollElementHeight(), this.container.scrollTop = 0, this.translateTo(0));
374
- }
375
- scrollToEnd() {
376
- this.container && this.list && (this.calcScrollElementHeight(), this.container.scrollTop = this.container.scrollHeight - this.container.offsetHeight, this.translateTo(this.container.scrollHeight));
377
- }
378
- localScrollUp(t) {
379
- const e = this.itemHeight, s = this.container.scrollTop;
380
- let n = this.listTranslate, a, p = s - n;
381
- if (!(p > e)) {
382
- for (a = 0; a < this.skip && !(n + e + p <= s); a++)
383
- n -= e;
384
- if (n = this.validateTranslate(n), this.skip - a <= 0 && n >= s) {
385
- this.translateTo(0), this.changePage(0, t), this.container.scrollTop = 0;
386
- return;
387
- }
388
- n !== this.listTranslate && (this.translateTo(n), this.changePage(this.skip - a, t));
389
- }
390
- }
391
- localScrollDown(t) {
392
- const e = this.itemHeight;
393
- let s = this.container.scrollTop, n = this.listTranslate;
394
- const a = this.list.children.length;
395
- let p;
396
- for (p = 0; p < a && !(n + e >= s); p++)
397
- n += e;
398
- n = this.validateTranslate(n), p >= a && this.skip + p >= this.total ? (this.translateTo(n), this.changePage(this.total - 1, t)) : n !== this.listTranslate && (this.translateTo(n), this.changePage(this.skip + p, t));
399
- }
400
- scrollNonStrict(t) {
401
- const e = this.total * this.prevScrollPos / this.containerHeight, s = Math.min(Math.floor(e), this.total - 1);
402
- let n = this.containerHeight * e / this.total;
403
- n = this.validateTranslate(n), this.translateTo(n), this.changePage(s, t);
404
- }
405
- scrollHandler(t) {
406
- const e = this.container ? this.container.scrollTop : 0, s = this.prevScrollPos;
407
- this.prevScrollPos = e, !(!this.enabled || !this.list || !this.container || this.scrollSyncing) && (e - s <= 0 && e > this.listTranslate - this.list.scrollHeight / 10 ? this.localScrollUp(t) : e - s > 0 && e < this.listTranslate + this.list.scrollHeight * 2 / 3 ? this.localScrollDown(t) : this.scrollNonStrict(t));
408
- }
409
- validateTranslate(t) {
410
- return t = Math.max(0, t), t = Math.min(this.containerHeight, t), t;
411
- }
412
- }
413
- class Js {
414
- navigate(t) {
415
- const e = t.keyCode;
416
- if (e === g.up || e === g.left)
417
- return this.next({ current: t.current, min: t.min, max: t.max, step: t.skipItems ? t.skipItems : -1 });
418
- if (e === g.down || e === g.right)
419
- return this.next({ current: t.current, min: t.min, max: t.max, step: t.skipItems ? t.skipItems : 1 });
420
- if (e === g.home)
421
- return 0;
422
- if (e === g.end)
423
- return t.max;
424
- }
425
- next(t) {
426
- return U(t.current) ? Math.min(t.max, Math.max(t.current + t.step, t.min)) : t.min;
427
- }
428
- }
429
- const Zt = class {
430
- constructor(i) {
431
- this.wrapper = null, this.list = null, this.vs = new Ys(), this.navigation = new Js(), this.handleItemClick = (t, e) => {
432
- const s = this.initState();
433
- s.syntheticEvent = e, e.stopPropagation(), this.component.handleItemSelect(t, s), this.togglePopup(s), this.applyState(s);
434
- }, this.handleFocus = (t) => {
435
- if (!this.component.state.focused) {
436
- const e = this.initState();
437
- e.data.focused = !0, e.events.push({ type: "onFocus" }), e.syntheticEvent = t, this.applyState(e);
438
- }
439
- }, this.filterChanged = (t, e) => {
440
- const { textField: s, filterable: n } = this.component.props;
441
- n && e.events.push({
442
- type: "onFilterChange",
443
- filter: {
444
- field: s,
445
- operator: "contains",
446
- ignoreCase: !0,
447
- value: t
448
- }
449
- });
450
- }, this.togglePopup = (t) => {
451
- const e = this.component.props, s = e.opened !== void 0 ? e.opened : this.component.state.opened;
452
- e.opened === void 0 && (t.data.opened = !s), s ? t.events.push({ type: "onClose" }) : (t.events.push({ type: "onOpen" }), this.calculatePopupWidth());
453
- }, this.pageChange = (t, e) => {
454
- const s = this.initState();
455
- s.syntheticEvent = e, this.triggerOnPageChange(s, t.skip, t.take), this.applyState(s);
456
- }, this.scrollToVirtualItem = (t, e) => {
457
- const s = this.vs;
458
- if (s.enabled = !1, t.skip === 0)
459
- s.reset();
460
- else if (t.skip + t.pageSize === t.total)
461
- s.scrollToEnd();
462
- else {
463
- let n = s.translate;
464
- n === 0 && (s.calcScrollElementHeight(), n = s.itemHeight * t.skip, s.translateTo(n - s.itemHeight)), s.container && (s.container.scrollTop = n), this.scrollToItem(e, !0);
465
- }
466
- window.setTimeout(() => s.enabled = !0, 10);
467
- }, this.scrollPopupByPageSize = (t) => {
468
- var p, c, d, r, h, u;
469
- const e = this.vs, s = (c = (p = this.list) == null ? void 0 : p.parentElement) == null ? void 0 : c.scrollTop, n = e.enabled && e.itemHeight ? e.itemHeight : this.list ? this.list.children[0].offsetHeight : 0, a = (r = (d = this.list) == null ? void 0 : d.parentElement) == null ? void 0 : r.offsetHeight;
470
- s !== void 0 && a !== void 0 && ((u = (h = this.list) == null ? void 0 : h.parentElement) == null || u.scroll({ top: s + t * Math.floor(a / n) * n }));
471
- }, this.renderScrollElement = () => {
472
- const t = this.vs;
473
- return t.enabled && /* @__PURE__ */ o.createElement(
474
- "div",
475
- {
476
- ref: (e) => t.scrollElement = e,
477
- key: "scrollElementKey"
478
- }
479
- );
480
- }, this.resetGroupStickyHeader = (t, e) => {
481
- t !== e.state.group && e.setState({ ...e.state, group: t });
482
- }, this.listBoxId = i.props.id + "list", this.guid = i.props.id, this.component = i, this.vs.PageChange = this.pageChange;
483
- }
484
- didMount() {
485
- const i = this.component.props, t = i.popupSettings || {}, e = i.style || {}, s = t.width;
486
- let n = i.opened === !0;
487
- s === void 0 && this.calculatePopupWidth(), i.dir === void 0 && e.direction === void 0 && (this.calculateDir(), n = !0), n && this.component.forceUpdate();
488
- }
489
- calculateDir() {
490
- const i = this.component.element;
491
- i && i.ownerDocument && i.ownerDocument.defaultView && (this.dirCalculated = i.ownerDocument.defaultView.getComputedStyle(i).direction || void 0);
492
- }
493
- calculatePopupWidth() {
494
- this.wrapper && (this.popupWidth = this.wrapper.offsetWidth + "px");
495
- }
496
- scrollToItem(i, t, e) {
497
- const s = this.list || this.vs.list;
498
- if (!s && !e && setTimeout(() => {
499
- this.scrollToItem(i, t, !0);
500
- }, 10), s && i >= 0) {
501
- const n = this.vs, a = n.container || s.parentNode, p = t !== void 0 ? t : n.enabled;
502
- zs(a, s, i, n.translate, p);
503
- }
504
- }
505
- initState() {
506
- return {
507
- data: {},
508
- events: [],
509
- syntheticEvent: void 0
510
- };
511
- }
512
- applyState(i) {
513
- Object.keys(i.data).length > 0 && this.component.setState(i.data);
514
- const t = {
515
- syntheticEvent: i.syntheticEvent,
516
- nativeEvent: i.syntheticEvent ? i.syntheticEvent.nativeEvent : void 0,
517
- target: this.component,
518
- value: this.component.value
519
- };
520
- i.events.forEach((e) => {
521
- const s = e.type;
522
- delete e.type;
523
- const n = s && this.component.props[s];
524
- n && n.call(void 0, {
525
- ...t,
526
- ...e
527
- });
528
- });
529
- }
530
- triggerOnPageChange(i, t, e) {
531
- const s = this.component.props.virtual;
532
- if (s) {
533
- const n = Math.min(Math.max(0, t), Math.max(0, s.total - e));
534
- n !== s.skip && i.events.push({
535
- type: "onPageChange",
536
- page: { skip: n, take: e }
537
- });
538
- }
539
- }
540
- triggerPageChangeCornerItems(i, t) {
541
- const e = this.component.props, { data: s = [], dataItemKey: n, virtual: a } = e, p = e.opened !== void 0 ? e.opened : this.component.state.opened;
542
- i && a && this.vs.enabled && (a.skip > 0 && R(i, s[0], n) ? this.triggerOnPageChange(t, a.skip - 1, a.pageSize) : !p && a.skip + a.pageSize < a.total && R(i, s[s.length - 1], n) && this.triggerOnPageChange(t, a.skip + 1, a.pageSize));
543
- }
544
- getPopupSettings() {
545
- return Object.assign({}, Zt.defaultProps.popupSettings, this.component.props.popupSettings);
546
- }
547
- getGroupedDataModernMode(i, t) {
548
- let e = [];
549
- return i.forEach((s, n) => {
550
- i[n - 1] && s[t] !== i[n - 1][t] && e.push({ [t]: s[t] }), e.push(i[n]);
551
- }), e;
552
- }
553
- };
554
- let oe = Zt;
555
- oe.basicPropTypes = {
556
- opened: l.bool,
557
- disabled: l.bool,
558
- dir: l.string,
559
- tabIndex: l.number,
560
- accessKey: l.string,
561
- data: l.array,
562
- textField: l.string,
563
- className: l.string,
564
- label: l.string,
565
- loading: l.bool,
566
- popupSettings: l.shape({
567
- animate: l.oneOfType([l.bool, l.shape({
568
- openDuration: l.number,
569
- closeDuration: l.number
570
- })]),
571
- popupClass: l.string,
572
- className: l.string,
573
- appendTo: l.any,
574
- width: l.oneOfType([l.string, l.number]),
575
- height: l.oneOfType([l.string, l.number])
576
- }),
577
- onOpen: l.func,
578
- onClose: l.func,
579
- onFocus: l.func,
580
- onBlur: l.func,
581
- onChange: l.func,
582
- itemRender: l.func,
583
- listNoDataRender: l.func,
584
- focusedItemIndex: l.func,
585
- header: l.node,
586
- footer: l.node
587
- };
588
- oe.propTypes = {
589
- ...Zt.basicPropTypes,
590
- value: l.any,
591
- defaultValue: l.any,
592
- filterable: l.bool,
593
- filter: l.string,
594
- virtual: l.shape({
595
- pageSize: l.number.isRequired,
596
- skip: l.number.isRequired,
597
- total: l.number.isRequired
598
- }),
599
- onFilterChange: l.func,
600
- onPageChange: l.func
601
- };
602
- oe.defaultProps = {
603
- popupSettings: {
604
- height: "200px"
605
- },
606
- required: !1,
607
- validityStyles: !0
608
- };
609
- const Ye = {
610
- name: "@progress/kendo-react-dropdowns",
611
- productName: "KendoReact",
612
- productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
613
- publishDate: 1709631857,
614
- version: "",
615
- licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"
616
- }, wt = 500, Ee = 768, Qs = "Please select a value from the list!", { sizeMap: Kt, roundedMap: Xs } = Ge, Wt = class extends o.Component {
617
- constructor(i) {
618
- super(i), this.state = {}, this._element = null, this.base = new oe(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 = () => {
619
- this.base.wrapper && this.base.wrapper.focus();
620
- }, this.handleItemSelect = (t, e) => {
621
- const { data: s = [], virtual: n, dataItemKey: a, defaultItem: p } = this.props, c = n ? n.skip : 0, d = t === -1 && p !== void 0 ? p : s[t - c], r = !R(d, this.value, a);
622
- this.triggerOnChange(d, e), r && this.base.triggerPageChangeCornerItems(d, e);
623
- }, this.componentRef = (t) => {
624
- this._element = t, this.base.wrapper = t;
625
- }, this.dummySelect = (t) => /* @__PURE__ */ o.createElement(
626
- "select",
627
- {
628
- name: this.props.name,
629
- ref: (e) => {
630
- this._select = e;
631
- },
632
- tabIndex: -1,
633
- "aria-hidden": !0,
634
- title: this.props.label,
635
- style: { opacity: 0, width: 1, border: 0, zIndex: -1, position: "absolute", left: "50%" }
636
- },
637
- /* @__PURE__ */ o.createElement(
638
- "option",
639
- {
640
- value: this.props.valueMap ? this.props.valueMap.call(void 0, t) : t
641
- }
642
- )
643
- ), this.renderListContainer = () => {
644
- const { header: t, footer: e, dir: s, data: n = [], size: a, groupField: p, groupStickyHeaderItemRender: c, list: d } = this.props, r = this.base, h = r.getPopupSettings(), u = this.props.opened !== void 0 ? this.props.opened : this.state.opened, f = h.width !== void 0 ? h.width : r.popupWidth, m = {
645
- dir: s !== void 0 ? s : r.dirCalculated,
646
- width: f,
647
- popupSettings: {
648
- ...h,
649
- popupClass: B(
650
- h.popupClass,
651
- "k-list-container",
652
- "k-dropdownlist-popup"
653
- ),
654
- anchor: h.anchor || this.element,
655
- show: u,
656
- onOpen: this.onPopupOpened,
657
- onClose: this.onPopupClosed
658
- },
659
- itemsCount: [n.length]
660
- };
661
- let { group: v } = this.state;
662
- return v === void 0 && p !== void 0 && (v = V(n[0], p)), /* @__PURE__ */ o.createElement(Ft, { ...m }, this.renderListFilter(), t && /* @__PURE__ */ o.createElement("div", { className: "k-list-header" }, t), /* @__PURE__ */ o.createElement(
663
- "div",
664
- {
665
- className: B(
666
- "k-list",
667
- {
668
- [`k-list-${Kt[a] || a}`]: a,
669
- "k-virtual-list": this.base.vs.enabled
670
- }
671
- )
672
- },
673
- this.renderDefaultItem(),
674
- !d && v && n.length !== 0 && /* @__PURE__ */ o.createElement(qe, { group: v, groupMode: "modern", render: c }),
675
- this.renderList()
676
- ), e && /* @__PURE__ */ o.createElement("div", { className: "k-list-footer" }, e));
677
- }, this.renderList = () => {
678
- const {
679
- data: t = [],
680
- textField: e,
681
- dataItemKey: s,
682
- virtual: n = { skip: 0, total: void 0 },
683
- groupHeaderItemRender: a,
684
- listNoDataRender: p,
685
- itemRender: c
686
- } = this.props, d = this.base.vs, r = n.skip, h = this.props.opened !== void 0 ? this.props.opened : this.state.opened, u = this.base.getPopupSettings(), f = `translateY(${d.translate}px)`;
687
- return /* @__PURE__ */ o.createElement(
688
- je,
689
- {
690
- id: this._listboxId,
691
- show: h,
692
- data: t.slice(),
693
- focusedIndex: this.getFocusedIndex(),
694
- value: this.value,
695
- textField: e,
696
- valueField: s,
697
- optionsGuid: this._guid,
698
- groupField: this.props.groupField,
699
- groupMode: "modern",
700
- listRef: (m) => d.list = this.base.list = m,
701
- wrapperStyle: { maxHeight: u.height },
702
- wrapperCssClass: "k-list-content",
703
- listStyle: d.enabled ? { transform: f } : void 0,
704
- key: "listkey",
705
- skip: r,
706
- onClick: this.handleItemClick,
707
- itemRender: c,
708
- groupHeaderItemRender: a,
709
- noDataRender: p,
710
- onScroll: this.onScroll,
711
- wrapperRef: d.scrollerRef,
712
- scroller: this.base.renderScrollElement(),
713
- ariaSetSize: n.total
714
- }
715
- );
716
- }, this.onScroll = (t) => {
717
- const { vs: e, list: s } = this.base;
718
- e.scrollHandler(t);
719
- const { groupField: n } = this.props;
720
- let { data: a = [] } = this.props;
721
- if (!(!n || !a.length) && n) {
722
- const p = this.itemHeight = this.itemHeight || (e.enabled ? e.itemHeight : s ? s.children[0].offsetHeight : 0), d = t.target.scrollTop - e.skip * p;
723
- a = this.base.getGroupedDataModernMode(a, n);
724
- let r = a[0][n];
725
- for (let h = 1; h < a.length && !(p * h > d); h++)
726
- a[h] && a[h][n] && (r = a[h][n]);
727
- r !== this.state.group && this.setState({
728
- group: r
729
- });
730
- }
731
- }, this.renderListFilter = () => {
732
- const t = this.props.filter !== void 0 ? this.props.filter : this.state.text;
733
- return this.props.filterable && /* @__PURE__ */ o.createElement(
734
- Re,
735
- {
736
- value: t,
737
- ref: (e) => this._filterInput = e && e.element,
738
- onChange: this.handleListFilterChange,
739
- onKeyDown: this.handleKeyDown,
740
- size: this.props.size,
741
- rounded: this.props.rounded,
742
- fillMode: this.props.fillMode
743
- }
744
- );
745
- }, this.renderDefaultItem = () => {
746
- const { textField: t, defaultItem: e, dataItemKey: s } = this.props;
747
- return e !== void 0 && /* @__PURE__ */ o.createElement(
748
- $s,
749
- {
750
- defaultItem: e,
751
- textField: t,
752
- selected: R(this.value, e, s),
753
- key: "defaultitemkey",
754
- onClick: this.handleDefaultItemClick
755
- }
756
- );
757
- }, this.search = (t) => {
758
- clearTimeout(this._typingTimeout), this.props.filterable || (this._typingTimeout = window.setTimeout(() => this.searchState.word = "", this.props.delay), this.selectNext(t));
759
- }, this.selectNext = (t) => {
760
- const { data: e = [], dataItemKey: s } = this.props;
761
- let n = e.map((k, D) => ({ item: k, itemIndex: D }));
762
- const a = this.searchState.word, p = this.searchState.last, c = Ks(a, p);
763
- let d = n.length, r = Math.max(0, e.findIndex((k) => R(k, this.value, s))), h;
764
- this.props.defaultItem && (h = { item: this.props.defaultItem, itemIndex: -1 }, d += 1, r += 1), r += c ? 1 : 0, n = Ls(n, r, h);
765
- let u, f, m, v = 0;
766
- const { textField: b, ignoreCase: w } = this.props;
767
- for (; v < d; v++)
768
- if (u = V(n[v].item, b), f = c && os(u, p, w), m = os(u, a, w), f || m) {
769
- v = n[v].itemIndex;
770
- break;
771
- }
772
- if (v !== d) {
773
- const k = this.base.initState();
774
- k.syntheticEvent = t, this.handleItemSelect(v, k), this.applyState(k), this._valueDuringOnChange = void 0;
775
- }
776
- }, this.handleKeyDown = (t) => {
777
- t && t.target instanceof Element && t.target.nodeName === "INPUT" && t.stopPropagation && t.stopPropagation();
778
- const {
779
- data: e = [],
780
- filterable: s,
781
- disabled: n,
782
- defaultItem: a,
783
- leftRightKeysNavigation: p = !0,
784
- virtual: c = { skip: 0, total: 0, pageSize: 0 },
785
- dataItemKey: d,
786
- groupField: r = "",
787
- textField: h,
788
- skipDisabledItems: u = !0
789
- } = this.props, f = this.value, m = e.findIndex((F) => R(F, f, d)), v = this.props.opened !== void 0 ? this.props.opened : this.state.opened, b = t.keyCode, w = b === g.home || b === g.end, k = b === g.up || b === g.down, D = !v && (t.altKey && b === g.down || b === g.enter || b === g.space), O = v && (t.altKey && b === g.up || b === g.esc), N = p && (b === g.left || b === g.right), _ = k || N && !s || w, S = this.base.initState();
790
- if (S.syntheticEvent = t, !n) {
791
- if (w && this.base.vs.enabled)
792
- b === g.home ? c.skip !== 0 ? (this.base.triggerOnPageChange(S, 0, c.pageSize), this._navigated = !0) : this.triggerOnChange(e[0], S) : c.skip < c.total - c.pageSize ? (this.base.triggerOnPageChange(S, c.total - c.pageSize, c.pageSize), this._navigated = !0) : this.triggerOnChange(e[e.length - 1], S);
793
- else if (v && b === g.pageUp)
794
- this.base.scrollPopupByPageSize(-1);
795
- else if (v && b === g.pageDown)
796
- this.base.scrollPopupByPageSize(1);
797
- else if (v && b === g.enter) {
798
- const F = this.getFocusedIndex();
799
- this.haveFocusedItemAndDataNotEmpty(e, F) ? (this.triggerOnChange(null, S), this.applyState(S)) : this.handleItemSelect(F, S), this.base.togglePopup(S), t.preventDefault();
800
- } else if (D || O)
801
- O && this.resetValueIfDisabledItem(), this.base.togglePopup(S), t.preventDefault();
802
- else if (_) {
803
- if (this._lastKeypressIsFilter = !1, r !== "" && h)
804
- if (!u && v)
805
- this.onNavigate(S, b);
806
- else {
807
- let F;
808
- if (b === g.down || b === g.right) {
809
- const C = e.slice(m + 1).find((E) => !E.disabled && E[h]);
810
- F = C && e.findIndex((E) => E[h] === C[h]);
811
- } else if (b === g.up || b === g.left) {
812
- let C;
813
- if (m === 0 && a)
814
- F = -1;
815
- else if (m === -1)
816
- C = e, F = e.findIndex((E) => !E.disabled && E[h]);
817
- else {
818
- C = e.slice(0, m);
819
- let E = C.pop();
820
- for (; E && E.disabled; )
821
- E = C.pop();
822
- F = E && e.findIndex((M) => M[h] === E[h]);
823
- }
824
- }
825
- if (F !== void 0) {
826
- const C = F - m;
827
- this.onNavigate(S, b, C);
828
- } else
829
- F === void 0 && e.findIndex((C) => C[h] === f[h]) === e.length - 1 && this.onNavigate(S, b);
830
- }
831
- else if (!u && v || w)
832
- this.onNavigate(S, b);
833
- else if (h) {
834
- let F;
835
- if (b === g.down || b === g.right) {
836
- const C = e.slice(m + 1).find((E) => !E.disabled && E[h]);
837
- F = C && e.findIndex((E) => E[h] === C[h]);
838
- } else if (b === g.up || b === g.left) {
839
- let C;
840
- if (m === 0 && a)
841
- F = -1;
842
- else if (m === -1)
843
- C = e, F = e.find((E) => !E.disabled && E[h]);
844
- else {
845
- C = e.slice(0, m);
846
- let E = C.pop();
847
- for (; E && E.disabled; )
848
- E = C.pop();
849
- F = E && e.findIndex((M) => M[h] === E[h]);
850
- }
851
- }
852
- if (F !== void 0) {
853
- const C = F - m;
854
- this.onNavigate(S, b, C);
855
- } else
856
- F === void 0 && e.findIndex((C) => C[h] === f[h]) === e.length - 1 && this.onNavigate(S, b);
857
- } else
858
- this.onNavigate(S, b);
859
- t.preventDefault();
860
- }
861
- this.applyState(S);
862
- }
863
- }, this.handleItemClick = (t, e) => {
864
- this.base.handleItemClick(t, e), this._valueDuringOnChange = void 0;
865
- }, this.handleFocus = (t) => {
866
- this._skipFocusEvent || this.base.handleFocus(t);
867
- }, this.handleBlur = (t) => {
868
- if (this._skipFocusEvent || !this.state.focused)
869
- return;
870
- const e = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { adaptive: s } = this.props, { windowWidth: n = 0 } = this.state, a = n <= Ee && s, p = this.base.initState();
871
- p.syntheticEvent = t, p.data.focused = !1, p.events.push({ type: "onBlur" }), e && this.resetValueIfDisabledItem(), e && !a && this.base.togglePopup(p), this.applyState(p);
872
- }, this.handleDefaultItemClick = (t) => {
873
- const e = this.base.initState();
874
- e.syntheticEvent = t, this.base.togglePopup(e), this.triggerOnChange(this.props.defaultItem, e), this.applyState(e);
875
- }, this.handleWrapperClick = (t) => {
876
- if (t.isPropagationStopped())
877
- return;
878
- const e = this.base.initState();
879
- e.syntheticEvent = t, this.state.focused || (e.data.focused = !0), this.resetValueIfDisabledItem(), this.base.togglePopup(e), this.applyState(e);
880
- }, this.handleKeyPress = (t) => {
881
- if (this.props.filterable || t.which === 0 || t.keyCode === g.enter)
882
- return;
883
- let e = String.fromCharCode(t.charCode || t.keyCode);
884
- this.props.ignoreCase && (e = e.toLowerCase()), e === " " && t.preventDefault(), this.searchState = {
885
- word: this.searchState.word + e,
886
- last: this.searchState.last + e
887
- }, this.search(t);
888
- }, this.handleListFilterChange = (t) => {
889
- const e = this.base.initState();
890
- e.syntheticEvent = t.syntheticEvent, this.props.filter === void 0 && (e.data.text = t.target.value), this.base.filterChanged(t.target.value, e), this._lastKeypressIsFilter = !0, this.applyState(e), this.setState({ group: void 0 });
891
- }, this.onPopupOpened = () => {
892
- this._filterInput && this.focusElement(this._filterInput), this.props.adaptive && setTimeout(() => {
893
- this._filterInput && this.focusElement(this._filterInput);
894
- }, 300);
895
- }, this.onPopupClosed = () => {
896
- this.state.focused && window.setTimeout(
897
- () => {
898
- this.state.focused && this.base.wrapper && this.focusElement(this.base.wrapper);
899
- }
900
- );
901
- }, this.setValidity = () => {
902
- this._select && this._select.setCustomValidity && this._select.setCustomValidity(
903
- this.validity.valid ? "" : this.props.validationMessage || Qs
904
- );
905
- }, $e(Ye);
906
- }
907
- get _inputId() {
908
- return this.props.id + "-accessibility-id";
909
- }
910
- get _listboxId() {
911
- return this.props.id + "-listbox-id";
912
- }
913
- get _guid() {
914
- return this.props.id + "-guid";
915
- }
916
- get document() {
917
- if (Me)
918
- return this.element && this.element.ownerDocument || document;
919
- }
920
- /**
921
- * @hidden
922
- */
923
- get element() {
924
- return this._element;
925
- }
926
- /**
927
- * The value of the DropDownList.
928
- */
929
- get value() {
930
- let i;
931
- return this._valueDuringOnChange !== void 0 ? i = this._valueDuringOnChange : this.props.value !== void 0 ? i = this.props.value : this.state.value !== void 0 ? i = this.state.value : this.props.defaultValue !== void 0 && (i = this.props.defaultValue), !U(i) && this.props.defaultItem !== void 0 && (i = this.props.defaultItem), i;
932
- }
933
- /**
934
- * The index of the selected item.
935
- */
936
- get index() {
937
- const { data: i = [], dataItemKey: t } = this.props, e = this.value;
938
- return i.findIndex((s) => R(s, e, t));
939
- }
940
- /**
941
- * Gets the `name` property of the DropDownList.
942
- */
943
- get name() {
944
- return this.props.name;
945
- }
946
- /**
947
- * Represents the validity state into which the DropDownList is set.
948
- */
949
- get validity() {
950
- const i = this.props.validationMessage !== void 0, t = !this.required || this.value !== null && this.value !== "" && this.value !== void 0, e = this.props.valid !== void 0 ? this.props.valid : t;
951
- return {
952
- customError: i,
953
- valid: e,
954
- valueMissing: this.value === null
955
- };
956
- }
957
- get validityStyles() {
958
- return this.props.validityStyles !== void 0 ? this.props.validityStyles : Wt.defaultProps.validityStyles;
959
- }
960
- /**
961
- * @hidden
962
- */
963
- get required() {
964
- return this.props.required !== void 0 ? this.props.required : Wt.defaultProps.required;
965
- }
966
- /**
967
- * @hidden
968
- */
969
- componentDidUpdate(i, t) {
970
- var u;
971
- const { dataItemKey: e, virtual: s, groupField: n = "", textField: a } = this.props, { data: p = [] } = this.props, c = i.virtual ? i.virtual.total : 0, d = this.props.opened !== void 0 ? this.props.opened : this.state.opened, r = i.opened !== void 0 ? i.opened : t.opened, h = !r && d;
972
- if (this.base.getPopupSettings().animate || h && this.onPopupOpened(), s && s.total !== c)
973
- this.base.vs.calcScrollElementHeight(), this.base.vs.reset();
974
- else {
975
- const f = this.value, m = i.value !== void 0 ? i.value : t.value;
976
- let v = p.findIndex((w) => R(w, f, e));
977
- n !== "" && f && a && (v = (u = this.base.getGroupedDataModernMode(p, n)) == null ? void 0 : u.map((w) => w[a]).indexOf(f[a]));
978
- const b = !R(m, f, e);
979
- h && s ? this.base.scrollToVirtualItem(s, v) : h && !s ? (this.onPopupOpened(), p && p.length !== 0 && this.base.resetGroupStickyHeader(p[0][n], this), this.base.scrollToItem(v)) : d && r && f && b && !this._navigated ? this.base.scrollToItem(v) : d && r && this._navigated && (this._navigated && s && s.skip === 0 ? this.base.vs.reset() : this._navigated && s && s.skip === s.total - s.pageSize && this.base.vs.scrollToEnd());
980
- }
981
- this._navigated = !1, this.setValidity();
982
- }
983
- /**
984
- * @hidden
985
- */
986
- componentDidMount() {
987
- var i;
988
- this.observerResize = Me && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this)), this.base.didMount(), this.setValidity(), (i = this.document) != null && i.body && this.observerResize && this.observerResize.observe(this.document.body);
989
- }
990
- /** @hidden */
991
- componentWillUnmount() {
992
- var i;
993
- (i = this.document) != null && i.body && this.observerResize && this.observerResize.disconnect();
994
- }
995
- /**
996
- * @hidden
997
- */
998
- render() {
999
- const i = We(this).toLanguageString(At, ce[At]), { style: t, className: e, label: s, dir: n, virtual: a, size: p, rounded: c, fillMode: d, adaptive: r } = this.props, { windowWidth: h = 0 } = this.state, u = this.props.opened !== void 0 ? this.props.opened : this.state.opened, f = this.value, m = V(f, this.props.textField), v = !this.validityStyles || this.validity.valid, b = this.base, w = b.vs, k = h <= Ee && r;
1000
- w.enabled = a !== void 0, a !== void 0 && (b.vs.skip = a.skip, b.vs.total = a.total, b.vs.pageSize = a.pageSize);
1001
- const {
1002
- dataItemKey: D,
1003
- data: O = [],
1004
- disabled: N,
1005
- tabIndex: _,
1006
- loading: S,
1007
- iconClassName: F,
1008
- svgIcon: C,
1009
- valueRender: E
1010
- } = this.props, { focused: M } = this.state, A = O.findIndex((K) => R(K, f, D)), j = /* @__PURE__ */ o.createElement("span", { id: this._inputId, className: "k-input-inner" }, /* @__PURE__ */ o.createElement("span", { className: "k-input-value-text" }, m)), Y = E !== void 0 ? E.call(void 0, j, f) : j, Z = /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(
1011
- "span",
1012
- {
1013
- ref: this.componentRef,
1014
- className: B(
1015
- "k-dropdownlist k-picker",
1016
- e,
1017
- {
1018
- [`k-picker-${Kt[p] || p}`]: p,
1019
- [`k-rounded-${Xs[c] || c}`]: c,
1020
- [`k-picker-${d}`]: d,
1021
- "k-focus": M,
1022
- "k-disabled": N,
1023
- "k-invalid": !v,
1024
- "k-loading": S,
1025
- "k-required": this.required
1026
- }
1027
- ),
1028
- style: s ? { ...t, width: void 0 } : t,
1029
- dir: n,
1030
- onMouseDown: u ? (K) => {
1031
- K.target.nodeName !== "INPUT" && (this.focusElement(this.base.wrapper), K.preventDefault());
1032
- } : void 0,
1033
- onFocus: this.handleFocus,
1034
- onBlur: this.handleBlur,
1035
- tabIndex: Gt(_, N),
1036
- accessKey: this.props.accessKey,
1037
- onKeyDown: this.handleKeyDown,
1038
- onKeyPress: this.handleKeyPress,
1039
- onClick: N ? void 0 : this.handleWrapperClick,
1040
- role: "combobox",
1041
- "aria-required": this.required,
1042
- "aria-disabled": N || void 0,
1043
- "aria-haspopup": "listbox",
1044
- "aria-expanded": u || !1,
1045
- "aria-owns": this._listboxId,
1046
- "aria-activedescendant": u ? "option-" + this._guid + "-" + (A + (a ? a.skip : 0)) : void 0,
1047
- "aria-label": this.props.ariaLabel || this.props.label,
1048
- "aria-labelledby": this.props.ariaLabelledBy,
1049
- "aria-describedby": this.props.ariaDescribedBy || this._inputId,
1050
- id: this.props.id,
1051
- title: this.props.title
1052
- },
1053
- Y,
1054
- S && /* @__PURE__ */ o.createElement(Ce, { className: "k-input-loading-icon", name: "loading" }),
1055
- /* @__PURE__ */ o.createElement(
1056
- Te,
1057
- {
1058
- tabIndex: -1,
1059
- type: "button",
1060
- "aria-label": i,
1061
- "aria-hidden": !0,
1062
- size: p,
1063
- fillMode: d,
1064
- iconClass: F,
1065
- className: "k-input-button",
1066
- rounded: null,
1067
- themeColor: "base",
1068
- icon: F ? void 0 : "caret-alt-down",
1069
- svgIcon: C || jt,
1070
- onMouseDown: (K) => this.state.focused && K.preventDefault()
1071
- }
1072
- ),
1073
- this.dummySelect(f),
1074
- !k && this.renderListContainer()
1075
- ), k && this.renderAdaptiveListContainer());
1076
- return s ? /* @__PURE__ */ o.createElement(
1077
- Ue,
1078
- {
1079
- label: s,
1080
- editorValue: m,
1081
- editorValid: v,
1082
- editorDisabled: this.props.disabled,
1083
- style: { width: t ? t.width : void 0 },
1084
- children: Z
1085
- }
1086
- ) : Z;
1087
- }
1088
- /**
1089
- * @hidden
1090
- */
1091
- onNavigate(i, t, e) {
1092
- const {
1093
- data: s = [],
1094
- defaultItem: n,
1095
- dataItemKey: a,
1096
- virtual: p = { skip: 0, total: 0, pageSize: 0 }
1097
- } = this.props, c = this.base.vs, d = this.value, r = s.findIndex((u) => R(u, d, a)), h = this.base.navigation.navigate({
1098
- current: p.skip + r,
1099
- max: (c.enabled ? p.total : s.length) - 1,
1100
- min: n !== void 0 ? -1 : 0,
1101
- keyCode: t,
1102
- skipItems: e || void 0
1103
- });
1104
- h !== void 0 && this.handleItemSelect(h, i), this.applyState(i);
1105
- }
1106
- renderAdaptiveListContainer() {
1107
- const { windowWidth: i = 0 } = this.state, { header: t, footer: e, size: s, adaptiveTitle: n, groupField: a, groupStickyHeaderItemRender: p, list: c, data: d = [] } = this.props, r = this.props.opened !== void 0 ? this.props.opened : this.state.opened, h = {
1108
- navigatable: !1,
1109
- navigatableElements: [],
1110
- expand: r,
1111
- animation: !0,
1112
- onClose: (f) => this.handleWrapperClick(f),
1113
- animationStyles: i <= wt ? { top: 0, width: "100%", height: "100%" } : void 0,
1114
- className: i <= wt ? "k-adaptive-actionsheet k-actionsheet-fullscreen" : "k-adaptive-actionsheet k-actionsheet-bottom"
1115
- };
1116
- let { group: u } = this.state;
1117
- return u === void 0 && a !== void 0 && (u = V(d[0], a)), /* @__PURE__ */ o.createElement(Jt, { ...h }, /* @__PURE__ */ o.createElement(Qt, { className: "k-text-center" }, /* @__PURE__ */ o.createElement("div", { className: "k-actionsheet-titlebar-group k-hbox" }, /* @__PURE__ */ o.createElement("div", { className: "k-actionsheet-title" }, /* @__PURE__ */ o.createElement("div", null, n)), /* @__PURE__ */ o.createElement("div", { className: "k-actionsheet-actions" }, /* @__PURE__ */ o.createElement(
1118
- Te,
1119
- {
1120
- tabIndex: 0,
1121
- "aria-label": "Cancel",
1122
- "aria-disabled": "false",
1123
- type: "button",
1124
- fillMode: "flat",
1125
- onClick: this.handleWrapperClick,
1126
- icon: "x",
1127
- svgIcon: at
1128
- }
1129
- ))), /* @__PURE__ */ o.createElement("div", { className: "k-actionsheet-titlebar-group k-actionsheet-filter" }, this.renderListFilter())), /* @__PURE__ */ o.createElement(lt, { className: "!k-overflow-hidden" }, t && /* @__PURE__ */ o.createElement("div", { className: "k-list-header" }, t), /* @__PURE__ */ o.createElement(
1130
- "div",
1131
- {
1132
- className: B(
1133
- "k-list",
1134
- {
1135
- [`k-list-${Kt[s] || s}`]: s,
1136
- "k-virtual-list": this.base.vs.enabled
1137
- }
1138
- )
1139
- },
1140
- this.renderDefaultItem(),
1141
- !c && u && d.length !== 0 && /* @__PURE__ */ o.createElement(qe, { group: u, groupMode: "modern", render: p }),
1142
- this.renderList()
1143
- ), e && /* @__PURE__ */ o.createElement("div", { className: "k-list-footer" }, e)));
1144
- }
1145
- getFocusedIndex() {
1146
- const i = this.value, {
1147
- data: t = [],
1148
- textField: e,
1149
- dataItemKey: s,
1150
- virtual: n = { skip: 0 },
1151
- focusedItemIndex: a = Ve,
1152
- filterable: p,
1153
- skipDisabledItems: c = !0
1154
- } = this.props, d = this.props.filter ? this.props.filter : this.state.text;
1155
- return c && e && !d && !i ? t.findIndex((r) => !r.disabled && r[e]) : U(i) && d === void 0 || p && d === "" ? t.findIndex((r) => R(r, i, s)) : d ? this._lastKeypressIsFilter ? a(t, d, e) : t.findIndex((r) => R(r, i, s)) : n.skip === 0 ? 0 : -1;
1156
- }
1157
- focusElement(i) {
1158
- this._skipFocusEvent = !0, i.focus(), window.setTimeout(() => this._skipFocusEvent = !1, 30);
1159
- }
1160
- triggerOnChange(i, t) {
1161
- R(this.value, i, this.props.dataItemKey) || (this.props.value === void 0 && (t.data.value = i), this._valueDuringOnChange = i, t.events.push({ type: "onChange" }));
1162
- }
1163
- applyState(i) {
1164
- this.base.applyState(i), this._valueDuringOnChange = void 0;
1165
- }
1166
- calculateMedia(i) {
1167
- for (const t of i)
1168
- this.setState({ windowWidth: t.target.clientWidth });
1169
- }
1170
- resetValueIfDisabledItem() {
1171
- const { data: i = [] } = this.props, t = this.base.initState(), e = this.getFocusedIndex();
1172
- this.haveFocusedItemAndDataNotEmpty(i, e) && (this.triggerOnChange(null, t), this.applyState(t));
1173
- }
1174
- haveFocusedItemAndDataNotEmpty(i, t) {
1175
- return t !== void 0 && t !== -1 && i && i.length > 0 && i[t].disabled;
1176
- }
1177
- };
1178
- let Tt = Wt;
1179
- Tt.displayName = "DropDownList";
1180
- Tt.propTypes = {
1181
- delay: l.number,
1182
- ignoreCase: l.bool,
1183
- iconClassName: l.string,
1184
- svgIcon: fs,
1185
- defaultItem: l.any,
1186
- valueRender: l.func,
1187
- valueMap: l.func,
1188
- validationMessage: l.string,
1189
- required: l.bool,
1190
- id: l.string,
1191
- ariaLabelledBy: l.string,
1192
- ariaDescribedBy: l.string,
1193
- ariaLabel: l.string,
1194
- leftRightKeysNavigation: l.bool,
1195
- title: l.string,
1196
- groupField: l.string,
1197
- list: l.any,
1198
- skipDisabledItems: l.bool,
1199
- ...oe.propTypes
1200
- };
1201
- Tt.defaultProps = {
1202
- delay: 500,
1203
- tabIndex: 0,
1204
- ignoreCase: !0,
1205
- ...oe.defaultProps,
1206
- required: !1,
1207
- size: "medium",
1208
- rounded: "medium",
1209
- fillMode: "solid",
1210
- groupMode: "modern"
1211
- };
1212
- const Zs = Be(), ei = Et(Dt(
1213
- Zs,
1214
- Tt
1215
- ));
1216
- ei.displayName = "KendoReactDropDownList";
1217
- class es extends o.Component {
1218
- constructor() {
1219
- super(...arguments), this._input = null;
1220
- }
1221
- /**
1222
- * @hidden
1223
- */
1224
- get input() {
1225
- return this._input;
1226
- }
1227
- componentDidUpdate(t) {
1228
- const e = t.value, s = t.suggestedText, { value: n, suggestedText: a, focused: p } = this.props, c = this.input, d = e !== n || a !== s, r = d && e.startsWith(n) && !(s && a && s.endsWith(a)), h = ws(document);
1229
- p && c && h !== c && c.focus(), a && d && !r && c && c.setSelectionRange(n.length - a.length, n.length);
1230
- }
1231
- render() {
1232
- const { expanded: t = !1, disabled: e, role: s = "listbox", render: n } = this.props, a = /* @__PURE__ */ o.createElement(
1233
- "input",
1234
- {
1235
- autoComplete: "off",
1236
- id: this.props.id,
1237
- type: "text",
1238
- key: "searchbar",
1239
- size: this.props.size,
1240
- placeholder: this.props.placeholder,
1241
- className: "k-input-inner",
1242
- tabIndex: this.props.tabIndex,
1243
- accessKey: this.props.accessKey,
1244
- role: s,
1245
- name: this.props.name,
1246
- value: this.props.value,
1247
- onChange: this.props.onChange,
1248
- ref: (p) => this._input = p,
1249
- onKeyDown: this.props.onKeyDown,
1250
- onFocus: this.props.onFocus,
1251
- onBlur: this.props.onBlur,
1252
- onClick: this.props.onClick,
1253
- "aria-disabled": e || void 0,
1254
- disabled: e || void 0,
1255
- readOnly: this.props.readOnly || void 0,
1256
- title: this.props.title,
1257
- "aria-haspopup": "listbox",
1258
- "aria-expanded": t,
1259
- "aria-owns": this.props.owns,
1260
- "aria-activedescendant": t ? this.props.activedescendant : void 0,
1261
- "aria-describedby": this.props.ariaDescribedBy,
1262
- "aria-labelledby": this.props.ariaLabelledBy,
1263
- "aria-required": this.props.ariaRequired
1264
- }
1265
- );
1266
- return n ? n.call(void 0, a) : a;
1267
- }
1268
- }
1269
- class rt extends o.Component {
1270
- constructor() {
1271
- super(...arguments), this.onMouseDown = (t) => t.preventDefault();
1272
- }
1273
- render() {
1274
- const t = We(this).toLanguageString(it, ce[it]);
1275
- return /* @__PURE__ */ o.createElement(
1276
- "span",
1277
- {
1278
- className: "k-clear-value",
1279
- role: "button",
1280
- onClick: this.props.onClick,
1281
- onMouseDown: this.onMouseDown,
1282
- tabIndex: -1,
1283
- title: t,
1284
- key: "clearbutton"
1285
- },
1286
- /* @__PURE__ */ o.createElement(Ce, { name: "x", icon: at })
1287
- );
1288
- }
1289
- }
1290
- vs(rt);
1291
- const ti = Es, Ne = ti, si = "Please enter a valid value!", { sizeMap: yt, roundedMap: ii } = Ge, xt = class extends o.Component {
1292
- constructor(i) {
1293
- super(i), this.state = {}, this.base = new oe(this), this._element = null, this._suggested = "", this._skipBlur = !1, this._input = null, this._adaptiveFilterInput = null, this.itemHeight = 0, this.focus = () => {
1294
- this._input && this._input.focus();
1295
- }, this.handleItemSelect = (t, e) => {
1296
- const { data: s = [], virtual: n, dataItemKey: a } = this.props, p = n ? n.skip : 0, c = s[t - p], d = !R(c, this.value, a);
1297
- this.triggerOnChange(c, e), this.state.text !== void 0 && (e.data.text = void 0), d && this.base.triggerPageChangeCornerItems(c, e);
1298
- }, this.onPopupOpened = () => {
1299
- setTimeout(() => {
1300
- this.mobileMode && this._adaptiveFilterInput && (this._skipBlur = !0, this._adaptiveFilterInput.focus(), this._skipBlur = !1);
1301
- }, 300);
1302
- }, this.componentRef = (t) => {
1303
- this._element = t, this.base.wrapper = t;
1304
- }, this.toggleBtnClick = (t) => {
1305
- const { data: e = [], skipDisabledItems: s, textField: n } = this.props, a = this.getFocusedIndex(), p = this.getCurrentValueDisabledStatus(n, e, a), c = this.props.opened !== void 0 ? this.props.opened : this.state.opened, d = this.base.initState();
1306
- if (d.syntheticEvent = t, !s && n && p && this.clearValueOnToggleBtnClick(t), this.base.togglePopup(d), !c && this.mobileMode) {
1307
- const r = this.props.adaptiveFilter !== void 0 ? this.props.adaptiveFilter : this.state.text || null;
1308
- this.base.filterChanged(r, d);
1309
- }
1310
- this.applyState(d);
1311
- }, this.renderMobileListFilter = () => {
1312
- const t = this.props.adaptiveFilter !== void 0 ? this.props.adaptiveFilter : this.state.text, e = V(this.value, this.props.textField), s = U(t) ? t : e;
1313
- return /* @__PURE__ */ o.createElement(
1314
- Re,
1315
- {
1316
- value: s,
1317
- ref: (n) => this._adaptiveFilterInput = n && n.element,
1318
- onChange: this.handleMobileFilterChange,
1319
- onKeyDown: this.onInputKeyDown,
1320
- size: this.props.size,
1321
- rounded: this.props.rounded,
1322
- fillMode: this.props.fillMode
1323
- }
1324
- );
1325
- }, this.handleMobileFilterChange = (t) => {
1326
- const e = this.base.initState();
1327
- e.syntheticEvent = t.syntheticEvent, e.data.text = t.target.value, this.base.filterChanged(t.target.value, e), this.applyState(e);
1328
- }, this.onScroll = (t) => {
1329
- const { vs: e, list: s } = this.base;
1330
- e.scrollHandler(t);
1331
- const { groupField: n } = this.props;
1332
- let { data: a = [] } = this.props;
1333
- if (!n || !a.length)
1334
- return;
1335
- const p = this.itemHeight = this.itemHeight || (e.enabled ? e.itemHeight : s ? s.children[0].offsetHeight : 0), d = t.target.scrollTop - e.skip * p;
1336
- this.props.groupMode === "modern" && (a = this.base.getGroupedDataModernMode(a, n));
1337
- let r = a[0][n];
1338
- for (let h = 1; h < a.length && !(p * h > d); h++)
1339
- a[h] && a[h][n] && (r = a[h][n]);
1340
- r !== this.state.group && (this.setState({
1341
- group: r
1342
- }), this.props.onGroupScroll && this.props.onGroupScroll.call(void 0, { group: r }));
1343
- }, this.handleItemClick = (t, e) => {
1344
- this.base.handleItemClick(t, e), this._valueDuringOnChange = void 0;
1345
- }, this.handleBlur = (t) => {
1346
- if (this.state.focused && !this._skipBlur) {
1347
- const e = this.base.initState(), { textField: s, data: n = [] } = this.props, a = this.getFocusedIndex(), c = !(a === -1) && this.getCurrentValueDisabledStatus(s, n, a);
1348
- e.data.focused = !1, e.events.push({ type: "onBlur" }), e.syntheticEvent = t, s && c && this.clearValueOnBlur(t), this.applyValueOnRejectSuggestions(t.currentTarget.value, e);
1349
- }
1350
- }, this.onInputClick = (t) => {
1351
- const e = this.props.opened !== void 0 ? this.props.opened : this.state.opened, s = this.props.adaptiveFilter !== void 0 ? this.props.adaptiveFilter : this.state.text || null;
1352
- if (!e && this.mobileMode) {
1353
- const n = this.base.initState();
1354
- n.syntheticEvent = t, this.base.togglePopup(n), this.base.filterChanged(s, n), this.applyState(n);
1355
- }
1356
- }, this.onInputKeyDown = (t) => {
1357
- const { data: e = [], skipDisabledItems: s, textField: n, dataItemKey: a, groupField: p } = this.props, c = this.value, d = Math.max(0, e.findIndex((w) => R(w, c, a))), r = t.keyCode, h = this.props.opened !== void 0 ? this.props.opened : this.state.opened, u = this.base.initState();
1358
- if (u.syntheticEvent = t, !t.altKey && (r === g.up || r === g.down)) {
1359
- if (t.preventDefault(), p !== "" && n)
1360
- if (!this.props.skipDisabledItems && h)
1361
- this.onNavigate(u, r);
1362
- else {
1363
- let w = 0;
1364
- if (r === g.down || r === g.right) {
1365
- const k = e.slice(d + 1 < e.length ? d + 1 : d).find((D) => !D.disabled && D[n]);
1366
- w = k && e.findIndex((D) => D[n] === k[n]);
1367
- } else if (r === g.up || r === g.left) {
1368
- let k;
1369
- if (d === 0)
1370
- k = e, w = e.findIndex((D) => !D.disabled && D[n]);
1371
- else {
1372
- k = e.slice(0, d);
1373
- let D = k.pop();
1374
- for (; D && D.disabled; )
1375
- D = k.pop();
1376
- w = D && e.findIndex((O) => O[n] === D[n]);
1377
- }
1378
- }
1379
- if (w !== void 0) {
1380
- const k = w - d;
1381
- this.onNavigate(u, r, k);
1382
- } else
1383
- w === void 0 && e.findIndex((k) => k[n] === c[n]) === e.length - 1 && this.onNavigate(u, r);
1384
- }
1385
- else if (!this.props.skipDisabledItems && h)
1386
- this.onNavigate(u, r);
1387
- else {
1388
- let w = null;
1389
- if (r === g.down || r === g.right)
1390
- w = e.slice(d + 1).find((k) => !k.disabled);
1391
- else if (r === g.up || r === g.left) {
1392
- const k = e.slice(0, d);
1393
- for (w = k.pop(); w && w.disabled; )
1394
- w = k.pop();
1395
- }
1396
- if (w) {
1397
- const k = w.id - d - 1;
1398
- this.onNavigate(u, r, k);
1399
- } else
1400
- this.onNavigate(u, r);
1401
- }
1402
- this.applyState(u);
1403
- }
1404
- const f = () => {
1405
- t.preventDefault(), this.base.togglePopup(u), this.applyState(u);
1406
- }, m = this.getFocusedIndex(), v = m === -1, b = !v && this.getCurrentValueDisabledStatus(n, e, m);
1407
- h ? r === g.pageUp ? this.base.scrollPopupByPageSize(-1) : r === g.pageDown ? this.base.scrollPopupByPageSize(1) : t.altKey && r === g.up ? f() : r === g.enter ? (t.preventDefault(), (n && !v && t.currentTarget.value ? e[m][n] : void 0) ? !s && n && b ? this.clearValueOnEnterOrEsc(t) : b || this.applyValueOnEnter(t.currentTarget.value, u) : this.applyValueOnEnter(t.currentTarget.value, u)) : r === g.esc && (!s && n && b && this.clearValueOnEnterOrEsc(t), this.applyValueOnRejectSuggestions(t.currentTarget.value, u)) : !h && r === g.esc ? this.clearValueOnEnterOrEsc(t) : t.altKey && r === g.down && f();
1408
- }, this.inputOnChange = (t) => {
1409
- const e = this.base.initState();
1410
- e.syntheticEvent = t;
1411
- const s = this.props.opened !== void 0 ? this.props.opened : this.state.opened, n = t.currentTarget, a = n.value;
1412
- if (this.props.suggest) {
1413
- const p = n.selectionEnd === a.length;
1414
- let c = this.props.filter !== void 0 ? this.props.filter : this.state.text;
1415
- U(c) || (c = V(this.value, this.props.textField) || "");
1416
- const d = c && c === a, r = c && c.length > a.length;
1417
- d || r || !p ? this._suggested = "" : this.suggestValue(a);
1418
- }
1419
- this.props.filter === void 0 && (e.data.text = a), this.state.focusedItem !== void 0 && (e.data.focusedItem = void 0), s || this.base.togglePopup(e), this.base.filterChanged(a, e), this.applyState(e), this.setState({ group: void 0 });
1420
- }, this.clearButtonClick = (t) => {
1421
- const e = this.base.initState();
1422
- e.syntheticEvent = t, t.stopPropagation(), this.clearValue();
1423
- }, this.clearValueOnEnterOrEsc = (t) => {
1424
- const e = this.base.initState();
1425
- e.syntheticEvent = t, t.stopPropagation(), this.clearValue();
1426
- }, this.clearValueOnBlur = (t) => {
1427
- const e = this.base.initState();
1428
- e.syntheticEvent = t, t.stopPropagation(), this.clearValue();
1429
- }, this.clearValueOnToggleBtnClick = (t) => {
1430
- const e = this.base.initState();
1431
- e.syntheticEvent = t, t.stopPropagation(), this.clearValue();
1432
- }, this.setValidity = () => {
1433
- this._input && this._input.setCustomValidity && this._input.setCustomValidity(
1434
- this.validity.valid ? "" : this.props.validationMessage || si
1435
- );
1436
- }, $e(Ye);
1437
- }
1438
- get _inputId() {
1439
- return this.props.id;
1440
- }
1441
- get document() {
1442
- if (Me)
1443
- return this.element && this.element.ownerDocument || document;
1444
- }
1445
- /** @hidden */
1446
- get element() {
1447
- return this._element;
1448
- }
1449
- /**
1450
- * The mobile mode of the ComboBox.
1451
- */
1452
- get mobileMode() {
1453
- return !!(this.state.windowWidth && this.state.windowWidth <= Ee && this.props.adaptive);
1454
- }
1455
- /**
1456
- * The value of the ComboBox.
1457
- */
1458
- get value() {
1459
- if (this._valueDuringOnChange !== void 0)
1460
- return this._valueDuringOnChange;
1461
- if (this.props.value !== void 0)
1462
- return this.props.value;
1463
- if (this.state.value !== void 0)
1464
- return this.state.value;
1465
- if (this.props.defaultValue !== void 0)
1466
- return this.props.defaultValue;
1467
- }
1468
- /**
1469
- * The index of the selected item.
1470
- */
1471
- get index() {
1472
- const { data: i = [], dataItemKey: t } = this.props, e = this.value;
1473
- return i.findIndex((s) => R(s, e, t));
1474
- }
1475
- /**
1476
- * Gets the `name` property of the ComboBox.
1477
- */
1478
- get name() {
1479
- return this.props.name;
1480
- }
1481
- /**
1482
- * Represents the validity state into which the component is set.
1483
- */
1484
- get validity() {
1485
- const i = this.props.validationMessage !== void 0, t = !this.required || this.value !== null && this.value !== "" && this.value !== void 0, e = this.props.valid !== void 0 ? this.props.valid : t;
1486
- return {
1487
- customError: i,
1488
- valid: e,
1489
- valueMissing: this.value === null
1490
- };
1491
- }
1492
- get validityStyles() {
1493
- return this.props.validityStyles !== void 0 ? this.props.validityStyles : xt.defaultProps.validityStyles;
1494
- }
1495
- /** @hidden */
1496
- get required() {
1497
- return this.props.required !== void 0 ? this.props.required : xt.defaultProps.required;
1498
- }
1499
- /** @hidden */
1500
- componentDidUpdate(i, t) {
1501
- var f;
1502
- const { dataItemKey: e, virtual: s, groupField: n = "", data: a = [], textField: p } = this.props, c = i.virtual ? i.virtual.total : 0, d = this.props.opened !== void 0 ? this.props.opened : this.state.opened, r = i.opened !== void 0 ? i.opened : t.opened, h = !r && d, u = this.value;
1503
- if (this._valueOnDidUpdate = u, s && s.total !== c)
1504
- this.base.vs.calcScrollElementHeight(), this.base.vs.reset();
1505
- else {
1506
- const m = i.value !== void 0 ? i.value : t.value;
1507
- let v = a.findIndex((w) => R(w, u, e));
1508
- this.props.groupMode === "modern" && p && u && (v = (f = this.base.getGroupedDataModernMode(a, n)) == null ? void 0 : f.map((w) => w[p]).indexOf(u[p]));
1509
- const b = !R(m, u, e);
1510
- h && s ? this.base.scrollToVirtualItem(s, v) : h && !s ? (this.onPopupOpened(), a && a.length !== 0 && this.base.resetGroupStickyHeader(a[0][n], this), this.base.scrollToItem(v)) : d && r && u && b && this.base.scrollToItem(v);
1511
- }
1512
- h && this._input && this._input.focus(), this.setValidity();
1513
- }
1514
- /** @hidden */
1515
- componentDidMount() {
1516
- var i;
1517
- this.observerResize = Me && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this)), this.base.didMount(), this.setValidity(), (i = this.document) != null && i.body && this.observerResize && this.observerResize.observe(this.document.body);
1518
- }
1519
- /** @hidden */
1520
- componentWillUnmount() {
1521
- var i;
1522
- (i = this.document) != null && i.body && this.observerResize && this.observerResize.disconnect();
1523
- }
1524
- /** @hidden */
1525
- render() {
1526
- const i = We(this).toLanguageString(zt, ce[zt]), t = We(this).toLanguageString(
1527
- Ht,
1528
- ce[Ht]
1529
- ), {
1530
- dir: e,
1531
- disabled: s,
1532
- clearButton: n = xt.defaultProps.clearButton,
1533
- label: a,
1534
- textField: p,
1535
- adaptive: c,
1536
- className: d,
1537
- style: r,
1538
- loading: h,
1539
- iconClassName: u,
1540
- virtual: f,
1541
- size: m,
1542
- rounded: v,
1543
- fillMode: b,
1544
- opened: w = this.state.opened,
1545
- placeholder: k,
1546
- svgIcon: D
1547
- } = this.props, { windowWidth: O = 0 } = this.state, N = !this.validityStyles || this.validity.valid, _ = this.props.filter !== void 0 ? this.props.filter : this.state.text, S = V(this.value, p), F = U(_) ? _ : S, C = n && (!!F || U(this.value)), M = this.base.vs, A = this.props.id || this._inputId, j = O <= Ee && c;
1548
- M.enabled = f !== void 0, f !== void 0 && (M.skip = f.skip, M.total = f.total, M.pageSize = f.pageSize);
1549
- const [Y, Z] = Ne(this.props.prefix || o.Fragment), [K, be] = Ne(this.props.suffix || o.Fragment), X = /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(
1550
- "span",
1551
- {
1552
- className: B(
1553
- "k-combobox k-input",
1554
- {
1555
- [`k-input-${yt[m] || m}`]: m,
1556
- [`k-rounded-${ii[v] || v}`]: v,
1557
- [`k-input-${b}`]: b,
1558
- "k-invalid": !N,
1559
- "k-loading": h,
1560
- "k-required": this.required,
1561
- "k-disabled": s
1562
- },
1563
- d
1564
- ),
1565
- ref: this.componentRef,
1566
- style: a ? { ...r, width: void 0 } : r,
1567
- dir: e
1568
- },
1569
- this.props.prefix && /* @__PURE__ */ o.createElement(Y, { ...Z }),
1570
- this.renderSearchBar(F || "", A, k),
1571
- C && !h && /* @__PURE__ */ o.createElement(rt, { onClick: this.clearButtonClick, key: "clearbutton" }),
1572
- h && /* @__PURE__ */ o.createElement(Ce, { className: "k-input-loading-icon", name: "loading", key: "loading" }),
1573
- this.props.suffix && /* @__PURE__ */ o.createElement(K, { ...be }),
1574
- /* @__PURE__ */ o.createElement(
1575
- Te,
1576
- {
1577
- tabIndex: -1,
1578
- type: "button",
1579
- "aria-label": w ? t : i,
1580
- icon: u ? void 0 : "caret-alt-down",
1581
- svgIcon: D || jt,
1582
- iconClass: u,
1583
- size: m,
1584
- fillMode: b,
1585
- rounded: null,
1586
- themeColor: "base",
1587
- className: "k-input-button",
1588
- onClick: this.toggleBtnClick,
1589
- onMouseDown: (Q) => Q.preventDefault()
1590
- }
1591
- ),
1592
- !j && this.renderListContainer()
1593
- ), j && this.renderAdaptiveListContainer());
1594
- return a ? /* @__PURE__ */ o.createElement(
1595
- Ue,
1596
- {
1597
- label: a,
1598
- editorId: A,
1599
- editorValue: F,
1600
- editorValid: N,
1601
- editorDisabled: s,
1602
- style: { width: r ? r.width : void 0 },
1603
- children: X
1604
- }
1605
- ) : X;
1606
- }
1607
- /** @hidden */
1608
- onNavigate(i, t, e) {
1609
- const { data: s = [], virtual: n = { skip: 0 } } = this.props, a = this.props.filter ? this.props.filter : this.state.text, p = this.getFocusedIndex(), c = this.base.vs, d = this.value;
1610
- if (this._suggested = "", p !== -1 && !U(d))
1611
- this.handleItemSelect(p, i);
1612
- else if (a === "")
1613
- this.handleItemSelect(0, i);
1614
- else {
1615
- const r = n.skip + p, h = this.base.navigation.navigate({
1616
- keyCode: t,
1617
- current: r,
1618
- max: (c.enabled ? c.total : s.length) - 1,
1619
- min: 0,
1620
- skipItems: e || void 0
1621
- });
1622
- h !== void 0 && this.handleItemSelect(h, i);
1623
- }
1624
- }
1625
- getCurrentValueDisabledStatus(i, t, e) {
1626
- return i && t && t[e] && t[e].disabled;
1627
- }
1628
- applyValueOnEnter(i, t) {
1629
- const { data: e = [], textField: s, allowCustom: n } = this.props, a = this.props.opened !== void 0 ? this.props.opened : this.state.opened, c = V(this.value, s) === i ? this.index : Lt(e, i, s), d = c !== -1;
1630
- let r;
1631
- if (this._suggested = "", d)
1632
- r = e[c];
1633
- else if (n)
1634
- r = s !== void 0 ? { [s]: i } : i;
1635
- else
1636
- return this.selectFocusedItem(i, t);
1637
- this.triggerOnChange(r, t), a && this.base.togglePopup(t), this.props.filter === void 0 && this.state.text !== void 0 && (t.data.text = void 0), this.applyState(t);
1638
- }
1639
- applyValueOnRejectSuggestions(i, t) {
1640
- const { data: e = [], textField: s, allowCustom: n } = this.props, a = this.props.opened !== void 0 ? this.props.opened : this.state.opened, p = V(this.value, s), c = this.state.windowWidth && this.state.windowWidth <= Ee;
1641
- if (this._suggested = "", i === p || i === "" && !U(p))
1642
- return a && !c && this.base.togglePopup(t), this.applyState(t);
1643
- const d = Lt(e, i, s, !0), r = d !== -1;
1644
- let h = null;
1645
- r ? h = e[d] : n && (h = i ? s ? { [s]: i } : i : null), this.triggerOnChange(h, t), this.state.text !== void 0 && (t.data.text = void 0, this.base.filterChanged("", t)), a && !c && this.base.togglePopup(t), this.applyState(t);
1646
- }
1647
- selectFocusedItem(i, t) {
1648
- const e = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { data: s = [], textField: n, virtual: a = { skip: 0 }, focusedItemIndex: p = Ve } = this.props, c = a.skip, d = i === "" && c === 0 ? 0 : p(s, i, n);
1649
- return d !== -1 ? this.handleItemSelect(d + c, t) : (this.triggerOnChange(null, t), this.state.text !== void 0 && (t.data.text = void 0)), e && this.base.togglePopup(t), this.applyState(t);
1650
- }
1651
- renderAdaptiveListContainer() {
1652
- const { windowWidth: i = 0 } = this.state, { header: t, footer: e, size: s, data: n = [], groupField: a, groupMode: p, list: c, virtual: d, adaptiveTitle: r, groupStickyHeaderItemRender: h } = this.props, u = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
1653
- let { group: f } = this.state;
1654
- f === void 0 && a !== void 0 && (f = V(n[0], a));
1655
- const m = {
1656
- navigatable: !1,
1657
- navigatableElements: [],
1658
- expand: u,
1659
- animation: !0,
1660
- onClose: (v) => this.toggleBtnClick(v),
1661
- animationStyles: i <= wt ? { top: 0, width: "100%", height: "100%" } : void 0,
1662
- className: i <= wt ? "k-adaptive-actionsheet k-actionsheet-fullscreen" : "k-adaptive-actionsheet k-actionsheet-bottom"
1663
- };
1664
- return /* @__PURE__ */ o.createElement(Jt, { ...m }, /* @__PURE__ */ o.createElement(Qt, { className: "k-text-center" }, /* @__PURE__ */ o.createElement("div", { className: "k-actionsheet-titlebar-group k-hbox" }, /* @__PURE__ */ o.createElement("div", { className: "k-actionsheet-title" }, /* @__PURE__ */ o.createElement("div", null, r)), /* @__PURE__ */ o.createElement("div", { className: "k-actionsheet-actions" }, /* @__PURE__ */ o.createElement(
1665
- Te,
1666
- {
1667
- tabIndex: 0,
1668
- "aria-label": "Cancel",
1669
- "aria-disabled": "false",
1670
- type: "button",
1671
- fillMode: "flat",
1672
- onClick: this.toggleBtnClick,
1673
- icon: "x",
1674
- svgIcon: at
1675
- }
1676
- ))), /* @__PURE__ */ o.createElement("div", { className: "k-actionsheet-titlebar-group k-actionsheet-filter" }, this.renderMobileListFilter())), /* @__PURE__ */ o.createElement(lt, { className: "!k-overflow-hidden" }, /* @__PURE__ */ o.createElement("div", { className: "k-list-container" }, /* @__PURE__ */ o.createElement("div", { className: B(
1677
- {
1678
- "k-list": !c,
1679
- "k-list-lg": !0,
1680
- "k-virtual-list": d,
1681
- "k-data-table": c,
1682
- [`k-table-${yt[s] || s}`]: c && s
1683
- }
1684
- ) }, t && /* @__PURE__ */ o.createElement("div", { className: "k-table-header" }, t), !c && f && n.length !== 0 && /* @__PURE__ */ o.createElement(qe, { group: f, groupMode: p, render: h }), this.renderList(), e && /* @__PURE__ */ o.createElement("div", { className: "k-list-footer" }, e)))));
1685
- }
1686
- renderListContainer() {
1687
- const i = this.base, { dir: t, header: e, footer: s, data: n = [], groupField: a, groupMode: p, size: c, list: d, virtual: r, groupStickyHeaderItemRender: h } = this.props, u = this.props.opened !== void 0 ? this.props.opened : this.state.opened, f = i.getPopupSettings(), m = f.width !== void 0 ? f.width : i.popupWidth;
1688
- let { group: v } = this.state;
1689
- return v === void 0 && a !== void 0 && (v = V(n[0], a)), /* @__PURE__ */ o.createElement(
1690
- Ft,
1691
- {
1692
- width: m,
1693
- popupSettings: {
1694
- ...f,
1695
- anchor: f.anchor || this.element,
1696
- show: u,
1697
- popupClass: B(
1698
- f.popupClass,
1699
- "k-list-container",
1700
- "k-combobox-popup"
1701
- )
1702
- },
1703
- dir: t !== void 0 ? t : this.base.dirCalculated,
1704
- itemsCount: [n.length]
1705
- },
1706
- /* @__PURE__ */ o.createElement("div", { className: B(
1707
- {
1708
- "k-list": !d,
1709
- [`k-list-${yt[c] || c}`]: !d && c,
1710
- "k-virtual-list": r,
1711
- "k-data-table": d,
1712
- [`k-table-${yt[c] || c}`]: d && c
1713
- }
1714
- ) }, e && /* @__PURE__ */ o.createElement("div", { className: "k-table-header" }, e), !d && v && n.length !== 0 && /* @__PURE__ */ o.createElement(qe, { group: v, groupMode: p, render: h }), this.renderList(), s && /* @__PURE__ */ o.createElement("div", { className: B(
1715
- {
1716
- "k-list-footer": !this.props.footerClassName
1717
- },
1718
- this.props.footerClassName
1719
- ) }, s))
1720
- );
1721
- }
1722
- renderList() {
1723
- const i = this.base, {
1724
- textField: t,
1725
- dataItemKey: e,
1726
- listNoDataRender: s,
1727
- itemRender: n,
1728
- groupHeaderItemRender: a,
1729
- data: p = [],
1730
- virtual: c = { skip: 0, total: void 0 }
1731
- } = this.props, d = i.getPopupSettings(), r = i.vs, h = c.skip, u = this.props.opened !== void 0 ? this.props.opened : this.state.opened, f = `translateY(${r.translate}px)`, m = u ? this.getFocusedIndex() : void 0, v = this.props.filter !== void 0 ? this.props.filter : this.state.text, b = V(this.value, t), w = U(v) && v !== b ? null : this.value, k = this.props.list || je;
1732
- return /* @__PURE__ */ o.createElement(
1733
- k,
1734
- {
1735
- id: i.listBoxId,
1736
- virtual: !!c,
1737
- show: u,
1738
- data: p,
1739
- focusedIndex: m,
1740
- value: w,
1741
- textField: t,
1742
- valueField: e,
1743
- groupField: this.props.groupField,
1744
- groupMode: this.props.groupMode,
1745
- isMultiColumn: this.props.isMultiColumn,
1746
- optionsGuid: i.guid,
1747
- listRef: (D) => {
1748
- r.list = this.base.list = D, this.itemHeight = 0;
1749
- },
1750
- wrapperStyle: this.state.windowWidth && this.state.windowWidth > Ee ? { maxHeight: d.height } : {},
1751
- wrapperCssClass: B(
1752
- "k-list-content",
1753
- {
1754
- "k-list-scroller": !c
1755
- }
1756
- ),
1757
- listStyle: r.enabled ? { transform: f } : void 0,
1758
- key: "listkey",
1759
- skip: h,
1760
- onClick: this.handleItemClick,
1761
- itemRender: n,
1762
- groupHeaderItemRender: a,
1763
- noDataRender: s,
1764
- onMouseDown: (D) => D.preventDefault(),
1765
- onScroll: this.onScroll,
1766
- wrapperRef: r.scrollerRef,
1767
- scroller: this.base.renderScrollElement(),
1768
- ariaSetSize: c.total
1769
- }
1770
- );
1771
- }
1772
- renderSearchBar(i, t, e) {
1773
- const {
1774
- tabIndex: s,
1775
- disabled: n,
1776
- data: a = [],
1777
- dataItemKey: p,
1778
- virtual: c = { skip: 0 }
1779
- } = this.props, d = this.props.opened !== void 0 ? this.props.opened : this.state.opened, r = this.value, h = Math.max(0, a.findIndex((u) => R(u, r, p)));
1780
- return this._suggested && !R(this._valueOnDidUpdate, r, p) && (this._suggested = ""), /* @__PURE__ */ o.createElement(
1781
- es,
1782
- {
1783
- id: t,
1784
- readOnly: d && this.mobileMode,
1785
- placeholder: e,
1786
- tabIndex: s,
1787
- title: this.props.title,
1788
- accessKey: this.props.accessKey,
1789
- value: i + this._suggested,
1790
- suggestedText: this._suggested,
1791
- ref: (u) => this._input = u && u.input,
1792
- onClick: this.onInputClick,
1793
- onKeyDown: this.onInputKeyDown,
1794
- onChange: this.inputOnChange,
1795
- onFocus: this.base.handleFocus,
1796
- onBlur: this.handleBlur,
1797
- disabled: n,
1798
- expanded: d,
1799
- owns: this.base.listBoxId,
1800
- activedescendant: `option-${this.base.guid}-${h + c.skip}`,
1801
- role: "combobox",
1802
- ariaLabelledBy: this.props.ariaLabelledBy,
1803
- ariaDescribedBy: this.props.ariaDescribedBy,
1804
- ariaRequired: this.required,
1805
- render: this.props.valueRender
1806
- }
1807
- );
1808
- }
1809
- clearValue() {
1810
- const i = this.base.initState();
1811
- this._suggested = "", this.base.filterChanged("", i), this.props.filter === void 0 && this.state.text !== void 0 && (i.data.text = void 0), this.triggerOnChange(null, i);
1812
- const t = this.props.opened !== void 0 ? this.props.opened : this.state.opened, e = this.mobileMode;
1813
- t && !e && this.base.togglePopup(i), this.applyState(i);
1814
- }
1815
- triggerOnChange(i, t) {
1816
- const e = this.value;
1817
- !U(e) && !U(i) || R(e, i, this.props.dataItemKey) || (this.props.value === void 0 && (t.data.value = i), this._valueDuringOnChange = i, t.events.push({ type: "onChange" }));
1818
- }
1819
- getFocusedIndex() {
1820
- const i = this.value, { data: t = [], textField: e, dataItemKey: s, virtual: n = { skip: 0 }, focusedItemIndex: a = Ve, skipDisabledItems: p } = this.props, c = this.props.filter ? this.props.filter : this.state.text;
1821
- return U(i) && c === void 0 ? t.findIndex((d) => R(d, i, s)) : c ? a(t, c, e) : p && e && !c && n.skip === 0 ? t.findIndex((d) => !d.disabled && d[e]) : n.skip === 0 ? 0 : -1;
1822
- }
1823
- suggestValue(i) {
1824
- const { data: t, textField: e } = this.props;
1825
- this._suggested = As(i, t, e);
1826
- }
1827
- applyState(i) {
1828
- this.base.applyState(i), this._valueDuringOnChange = void 0;
1829
- }
1830
- calculateMedia(i) {
1831
- for (const t of i)
1832
- this.setState({ windowWidth: t.target.clientWidth });
1833
- }
1834
- };
1835
- let dt = xt;
1836
- dt.displayName = "ComboBox";
1837
- dt.propTypes = {
1838
- ...oe.propTypes,
1839
- size: l.oneOf([null, "small", "medium", "large"]),
1840
- rounded: l.oneOf([null, "small", "medium", "large", "full"]),
1841
- fillMode: l.oneOf([null, "solid", "flat", "outline"]),
1842
- dataItemKey: l.string,
1843
- groupField: l.string,
1844
- groupMode: l.oneOf([void 0, "classic", "modern"]),
1845
- isMultiColumn: l.bool,
1846
- suggest: l.bool,
1847
- placeholder: l.string,
1848
- title: l.string,
1849
- allowCustom: l.bool,
1850
- clearButton: l.bool,
1851
- iconClassName: l.string,
1852
- svgIcon: fs,
1853
- validationMessage: l.string,
1854
- required: l.bool,
1855
- id: l.string,
1856
- ariaLabelledBy: l.string,
1857
- ariaDescribedBy: l.string,
1858
- list: l.any,
1859
- valueRender: l.func,
1860
- skipDisabledItems: l.bool
1861
- };
1862
- dt.defaultProps = {
1863
- ...oe.defaultProps,
1864
- size: "medium",
1865
- rounded: "medium",
1866
- fillMode: "solid",
1867
- allowCustom: !1,
1868
- clearButton: !0,
1869
- required: !1,
1870
- groupMode: "modern",
1871
- isMultiColumn: !1,
1872
- skipDisabledItems: !0,
1873
- prefix: void 0,
1874
- suffix: void 0
1875
- };
1876
- const ni = Be(), ys = Et(Dt(ni, dt));
1877
- ys.displayName = "KendoReactComboBox";
1878
- const oi = "Please enter a valid value!", { sizeMap: ls, roundedMap: ai } = Ge, qt = class extends o.Component {
1879
- constructor(i) {
1880
- super(i), this.state = {}, this.base = new oe(this), this._element = null, this._suggested = "", this._input = null, this._isScrolling = !1, this.itemHeight = 0, this.focus = () => {
1881
- this._input && this._input.focus();
1882
- }, this.handleItemSelect = (t, e) => {
1883
- const { data: s = [] } = this.props, n = V(s[t], this.props.textField);
1884
- this.triggerOnChange(n, e);
1885
- }, this.itemFocus = (t, e) => {
1886
- const { data: s = [], textField: n } = this.props, a = s[t];
1887
- R(this.state.focusedItem, a, n) || (e.data.focusedItem = a);
1888
- }, this.togglePopup = (t) => {
1889
- this.base.togglePopup(t);
1890
- }, this.setValidity = () => {
1891
- this._input && this._input.setCustomValidity && this._input.setCustomValidity(
1892
- this.validity.valid ? "" : this.props.validationMessage || oi
1893
- );
1894
- }, this.onScroll = (t) => {
1895
- this._isScrolling = !0;
1896
- const { list: e } = this.base, { groupField: s } = this.props;
1897
- let { data: n = [] } = this.props;
1898
- if (!s || !n.length)
1899
- return;
1900
- const a = this.itemHeight || (e ? e.children[0].offsetHeight : 0), c = t.target.scrollTop;
1901
- s && (n = this.base.getGroupedDataModernMode(n, s));
1902
- let d = n[0][s];
1903
- for (let r = 1; r < n.length && !(a * r > c); r++)
1904
- n[r] && n[r][s] && (d = n[r][s]);
1905
- d !== this.state.group && this.setState({
1906
- group: d
1907
- });
1908
- }, this.handleItemClick = (t, e) => {
1909
- this.base.handleItemClick(t, e), this._valueDuringOnChange = void 0;
1910
- }, this.onChangeHandler = (t) => {
1911
- const s = this.base.initState(), n = t.currentTarget, a = n.value, p = n.selectionEnd === a.length;
1912
- s.syntheticEvent = t;
1913
- const c = this._suggested, d = this.value, r = d && d.substring(0, d.length - c.length), h = r && r === a, u = r && r.length > a.length, { suggest: f } = this.props, m = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
1914
- if (f !== void 0 && f !== !1) {
1915
- h || u || !p ? this._suggested = "" : this.suggestValue(a);
1916
- const v = a + this._suggested, b = { userInput: a, value: this._suggested };
1917
- this.triggerOnChange(v, s, { suggestion: b });
1918
- } else
1919
- this._suggested = "", this.triggerOnChange(a, s);
1920
- (!m && a || m && !a) && this.togglePopup(s), s.data.focusedItem = void 0, this.applyState(s), this.setState({ group: void 0 });
1921
- }, this.clearButtonClick = (t) => {
1922
- const s = this.base.initState(), n = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
1923
- s.syntheticEvent = t;
1924
- const a = "";
1925
- this._suggested = "", this.triggerOnChange(a, s), this.state.focusedItem !== void 0 && (s.data.focusedItem = void 0), n && this.togglePopup(s), this.applyState(s);
1926
- }, this.onInputKeyDown = (t) => {
1927
- const { data: e = [], skipDisabledItems: s, groupField: n, textField: a } = this.props;
1928
- this._isScrolling && (this._isScrolling = !1);
1929
- const p = this.focusedIndex(), c = e[p], d = t.keyCode, r = t.altKey, h = this.props.opened !== void 0 ? this.props.opened : this.state.opened, u = this.base.initState();
1930
- u.syntheticEvent = t;
1931
- const f = () => {
1932
- h && t.preventDefault();
1933
- };
1934
- if (r && d === g.down)
1935
- this.setState({
1936
- opened: !0
1937
- });
1938
- else if (r && d === g.up)
1939
- this.setState({
1940
- opened: !1
1941
- });
1942
- else if (h && d === g.pageUp)
1943
- this.base.scrollPopupByPageSize(-1);
1944
- else if (h && d === g.pageDown)
1945
- this.base.scrollPopupByPageSize(1);
1946
- else if (h && (d === g.enter || d === g.esc))
1947
- f(), s === !1 && c && c.disabled ? (h && this.togglePopup(u), this.applyState(u)) : this.applyInputValue(t.currentTarget.value, u, t.keyCode);
1948
- else if (!h && d === g.esc) {
1949
- const m = "";
1950
- this._suggested = "", this.triggerOnChange(m, u), this.state.focusedItem !== void 0 && (u.data.focusedItem = void 0), this.applyState(u);
1951
- } else if (d === g.up || d === g.down) {
1952
- if (n !== "" && a)
1953
- if (!this.props.skipDisabledItems && h)
1954
- this.onNavigate(u, d);
1955
- else {
1956
- let m = 0;
1957
- if (d === g.down || d === g.right) {
1958
- const v = e.slice(p + 1).find((b) => !b.disabled && b[a]);
1959
- m = v && e.findIndex((b) => b[a] === v[a]);
1960
- } else if (d === g.up || d === g.left) {
1961
- let v;
1962
- if (p === -1)
1963
- v = e, m = e.findIndex((b) => !b.disabled && b[a]);
1964
- else {
1965
- v = e.slice(0, p);
1966
- let b = v.pop();
1967
- for (; b && b.disabled; )
1968
- b = v.pop();
1969
- m = b && e.findIndex((w) => w[a] === b[a]);
1970
- }
1971
- }
1972
- if (m !== void 0) {
1973
- const v = m - p;
1974
- this.onNavigate(u, d, v);
1975
- } else
1976
- m === void 0 && e.findIndex((v) => v[a]) === e.length - 1 && this.onNavigate(u, d);
1977
- }
1978
- else if (!this.props.skipDisabledItems && h)
1979
- this.onNavigate(u, d);
1980
- else {
1981
- let m = null;
1982
- if (d === g.down || d === g.right)
1983
- m = e.slice(p + 1).find((v) => !v.disabled);
1984
- else if (d === g.up || d === g.left) {
1985
- const v = e.slice(0, p);
1986
- for (m = v.pop(); m && m.disabled; )
1987
- m = v.pop();
1988
- }
1989
- if (m) {
1990
- const v = m.id - p - 1;
1991
- this.onNavigate(u, d, v);
1992
- } else
1993
- this.onNavigate(u, d);
1994
- }
1995
- this.applyState(u), f();
1996
- }
1997
- }, this.handleBlur = (t) => {
1998
- if (this.state.focused) {
1999
- const e = this.base.initState();
2000
- e.data.focused = !1, e.events.push({ type: "onBlur" }), e.syntheticEvent = t, this.applyInputValue(t.currentTarget.value, e);
2001
- }
2002
- }, $e(Ye);
2003
- }
2004
- get _inputId() {
2005
- return this.props.id + "-accessibility-id";
2006
- }
2007
- /**
2008
- * @hidden
2009
- */
2010
- get element() {
2011
- return this._element;
2012
- }
2013
- /**
2014
- * The value of the AutoComplete.
2015
- */
2016
- get value() {
2017
- return this._valueDuringOnChange !== void 0 ? this._valueDuringOnChange : this.props.value !== void 0 ? this.props.value : this.state.value !== void 0 ? this.state.value : this.props.defaultValue !== void 0 ? this.props.defaultValue : "";
2018
- }
2019
- /**
2020
- * Gets the `name` property of the AutoComplete.
2021
- */
2022
- get name() {
2023
- return this.props.name;
2024
- }
2025
- /**
2026
- * Represents the validity state into which the AutoComplete is set.
2027
- */
2028
- get validity() {
2029
- const i = this.props.validationMessage !== void 0, t = !this.required || this.value !== "", e = this.props.valid !== void 0 ? this.props.valid : t;
2030
- return {
2031
- customError: i,
2032
- valid: e,
2033
- valueMissing: this.value === null
2034
- };
2035
- }
2036
- /**
2037
- * @hidden
2038
- */
2039
- get validityStyles() {
2040
- return this.props.validityStyles !== void 0 ? this.props.validityStyles : qt.defaultProps.validityStyles;
2041
- }
2042
- /**
2043
- * @hidden
2044
- */
2045
- get required() {
2046
- return this.props.required !== void 0 ? this.props.required : qt.defaultProps.required;
2047
- }
2048
- /**
2049
- * @hidden
2050
- */
2051
- componentDidUpdate(i, t) {
2052
- var f;
2053
- const { groupField: e = "", data: s = [] } = this.props, { data: n = [] } = i, a = this.focusedIndex(), p = s[a], c = n !== s, d = p !== void 0 && t.focusedItem !== p, r = this.props.opened !== void 0 ? this.props.opened : this.state.opened, h = i.opened !== void 0 ? i.opened : t.opened, u = !h && r;
2054
- if (e === "")
2055
- (r && (d || c) || u) && this.base.scrollToItem(a);
2056
- else if (!this._isScrolling) {
2057
- let m = (f = this.base.getGroupedDataModernMode(s, e)) == null ? void 0 : f.indexOf(p);
2058
- u && (s && s.length !== 0 && this.base.resetGroupStickyHeader(s[0][e], this), this.base.scrollToItem(m)), r && h && d && this.base.scrollToItem(m);
2059
- }
2060
- this.setValidity();
2061
- }
2062
- /**
2063
- * @hidden
2064
- */
2065
- componentDidMount() {
2066
- this.base.didMount(), this.setValidity();
2067
- }
2068
- /**
2069
- * @hidden
2070
- */
2071
- render() {
2072
- const { dir: i, disabled: t, label: e, className: s, style: n, loading: a, suggest: p, size: c, rounded: d, fillMode: r } = this.props, h = !this.validityStyles || this.validity.valid, u = this.base, f = this.value, m = this.props.clearButton !== !1 && !a && !!f, v = this.props.id || this._inputId;
2073
- typeof p == "string" && (this._suggested = p);
2074
- const [b, w] = Ne(this.props.prefix || o.Fragment), [k, D] = Ne(this.props.suffix || o.Fragment), O = /* @__PURE__ */ o.createElement(
2075
- "span",
2076
- {
2077
- className: B(
2078
- "k-autocomplete k-input",
2079
- s,
2080
- {
2081
- [`k-input-${ls[c] || c}`]: c,
2082
- [`k-rounded-${ai[d] || d}`]: d,
2083
- [`k-input-${r}`]: r,
2084
- "k-invalid": !h,
2085
- "k-loading": a,
2086
- "k-required": this.required,
2087
- "k-disabled": t
2088
- }
2089
- ),
2090
- ref: (N) => {
2091
- this._element = N, u.wrapper = N;
2092
- },
2093
- style: e ? { ...n, width: void 0 } : n,
2094
- dir: i
2095
- },
2096
- this.props.prefix && /* @__PURE__ */ o.createElement(b, { ...w }),
2097
- this.renderSearchBar(f || "", v),
2098
- a && /* @__PURE__ */ o.createElement(Ce, { className: "k-input-loading-icon", name: "loading" }),
2099
- m && !a && /* @__PURE__ */ o.createElement(rt, { onClick: this.clearButtonClick, key: "clearbutton" }),
2100
- this.props.suffix && /* @__PURE__ */ o.createElement(k, { ...D }),
2101
- this.renderListContainer()
2102
- );
2103
- return e ? /* @__PURE__ */ o.createElement(
2104
- Ue,
2105
- {
2106
- label: e,
2107
- editorId: v,
2108
- editorValue: f,
2109
- editorValid: h,
2110
- editorDisabled: t,
2111
- style: { width: n ? n.width : void 0 },
2112
- children: O
2113
- }
2114
- ) : O;
2115
- }
2116
- /**
2117
- * @hidden
2118
- */
2119
- onNavigate(i, t, e) {
2120
- const s = this.value, { data: n = [], textField: a, focusedItemIndex: p } = this.props, c = this.state.focusedItem !== void 0 ? n.findIndex((r) => R(r, this.state.focusedItem, a)) : p ? p(n, s, a) : n.indexOf(as(n, s, a)), d = this.base.navigation.navigate({
2121
- keyCode: t,
2122
- current: c,
2123
- max: n.length - 1,
2124
- min: 0,
2125
- skipItems: e || void 0
2126
- });
2127
- d !== void 0 && this.itemFocus(d, i), this.applyState(i);
2128
- }
2129
- /**
2130
- * @hidden
2131
- */
2132
- applyInputValue(i, t, e) {
2133
- const s = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { data: n = [], textField: a } = this.props, p = this.focusedIndex(), c = n[p];
2134
- if (this._suggested = "", s && e === g.enter && c && !c.disabled) {
2135
- const d = V(n[this.focusedIndex(i)], a);
2136
- this.triggerOnChange(d, t);
2137
- }
2138
- s && this.togglePopup(t), this.applyState(t);
2139
- }
2140
- renderSearchBar(i, t) {
2141
- const e = this.base, { placeholder: s, tabIndex: n, disabled: a, readonly: p } = this.props, { focused: c } = this.state, d = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
2142
- return /* @__PURE__ */ o.createElement(
2143
- es,
2144
- {
2145
- id: t,
2146
- placeholder: s,
2147
- tabIndex: n,
2148
- accessKey: this.props.accessKey,
2149
- value: i,
2150
- suggestedText: this._suggested,
2151
- focused: c,
2152
- name: this.props.name,
2153
- ref: (r) => this._input = r && r.input,
2154
- onKeyDown: this.onInputKeyDown,
2155
- onChange: this.onChangeHandler,
2156
- onFocus: e.handleFocus,
2157
- onBlur: this.handleBlur,
2158
- disabled: a,
2159
- readOnly: p,
2160
- expanded: d,
2161
- owns: e.listBoxId,
2162
- activedescendant: "option-" + e.guid + "-" + this.focusedIndex(),
2163
- role: "combobox",
2164
- ariaLabelledBy: this.props.ariaLabelledBy,
2165
- ariaDescribedBy: this.props.ariaDescribedBy,
2166
- ariaRequired: this.required,
2167
- render: this.props.valueRender
2168
- }
2169
- );
2170
- }
2171
- renderListContainer() {
2172
- const i = this.base, {
2173
- dir: t,
2174
- header: e,
2175
- footer: s,
2176
- data: n = [],
2177
- size: a,
2178
- groupField: p,
2179
- list: c,
2180
- groupStickyHeaderItemRender: d
2181
- } = this.props, r = i.getPopupSettings(), h = this.props.opened !== void 0 ? this.props.opened : this.state.opened, u = r.width !== void 0 ? r.width : i.popupWidth;
2182
- let { group: f } = this.state;
2183
- return f === void 0 && p !== void 0 && (f = V(n[0], p)), /* @__PURE__ */ o.createElement(
2184
- Ft,
2185
- {
2186
- width: u,
2187
- popupSettings: {
2188
- ...r,
2189
- anchor: r.anchor || this.element,
2190
- show: h,
2191
- popupClass: B(
2192
- r.popupClass,
2193
- "k-list-container",
2194
- "k-autocomplete-popup"
2195
- )
2196
- },
2197
- dir: t !== void 0 ? t : this.base.dirCalculated,
2198
- itemsCount: [n.length]
2199
- },
2200
- e && /* @__PURE__ */ o.createElement("div", { className: "k-list-header" }, e),
2201
- /* @__PURE__ */ o.createElement(
2202
- "div",
2203
- {
2204
- className: B(
2205
- "k-list",
2206
- {
2207
- [`k-list-${ls[a] || a}`]: a
2208
- }
2209
- )
2210
- },
2211
- !c && f && n.length !== 0 && /* @__PURE__ */ o.createElement(qe, { group: f, groupMode: "modern", render: d }),
2212
- this.renderList()
2213
- ),
2214
- s && /* @__PURE__ */ o.createElement("div", { className: "k-list-footer" }, s)
2215
- );
2216
- }
2217
- renderList() {
2218
- const i = this.base, t = i.getPopupSettings(), {
2219
- textField: e,
2220
- data: s = [],
2221
- listNoDataRender: n,
2222
- itemRender: a,
2223
- groupHeaderItemRender: p
2224
- } = this.props, c = this.value, d = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
2225
- return /* @__PURE__ */ o.createElement(
2226
- je,
2227
- {
2228
- id: i.listBoxId,
2229
- show: d,
2230
- data: s.slice(),
2231
- focusedIndex: this.focusedIndex(),
2232
- value: c,
2233
- textField: e,
2234
- valueField: e,
2235
- highlightSelected: !1,
2236
- optionsGuid: i.guid,
2237
- groupField: this.props.groupField,
2238
- groupMode: "modern",
2239
- listRef: (r) => i.list = r,
2240
- wrapperStyle: { maxHeight: t.height },
2241
- wrapperCssClass: "k-list-content",
2242
- onClick: this.handleItemClick,
2243
- itemRender: a,
2244
- groupHeaderItemRender: p,
2245
- noDataRender: n,
2246
- onMouseDown: (r) => r.preventDefault(),
2247
- onScroll: this.onScroll
2248
- }
2249
- );
2250
- }
2251
- triggerOnChange(i, t, e) {
2252
- this.value === i && !e || (t.data.value = i, this._valueDuringOnChange = i, t.events.push({ type: "onChange", ...e || {} }));
2253
- }
2254
- applyState(i) {
2255
- this.base.applyState(i), this._valueDuringOnChange = void 0;
2256
- }
2257
- suggestValue(i) {
2258
- if (this._suggested = "", i) {
2259
- const { data: t = [], textField: e } = this.props, s = t[Ve(t, i, e)];
2260
- if (s) {
2261
- const n = V(s, e);
2262
- i.toLowerCase() !== n.toLowerCase() && (this._suggested = n.substring(i.length));
2263
- }
2264
- }
2265
- }
2266
- focusedIndex(i) {
2267
- const { data: t = [], textField: e, focusedItemIndex: s, skipDisabledItems: n } = this.props, a = i !== void 0 ? i : this.value;
2268
- if (this.state.focusedItem !== void 0)
2269
- return t.findIndex((p) => R(p, this.state.focusedItem, e));
2270
- if (s)
2271
- return s(t, a, e);
2272
- {
2273
- const p = t.indexOf(as(t, a, e));
2274
- return n && e && p === -1 ? t.findIndex((c) => !c.disabled && c[e]) : Math.max(0, p);
2275
- }
2276
- }
2277
- };
2278
- let Mt = qt;
2279
- Mt.displayName = "AutoComplete";
2280
- Mt.propTypes = {
2281
- ...oe.basicPropTypes,
2282
- size: l.oneOf([null, "small", "medium", "large"]),
2283
- rounded: l.oneOf([null, "small", "medium", "large", "full"]),
2284
- fillMode: l.oneOf([null, "solid", "flat", "outline"]),
2285
- groupField: l.string,
2286
- suggest: l.oneOfType([l.bool, l.string]),
2287
- placeholder: l.string,
2288
- value: l.string,
2289
- defaultValue: l.string,
2290
- validationMessage: l.string,
2291
- required: l.bool,
2292
- readonly: l.bool,
2293
- clearButton: l.bool,
2294
- valueRender: l.func,
2295
- id: l.string,
2296
- ariaLabelledBy: l.string,
2297
- ariaDescribedBy: l.string,
2298
- list: l.any,
2299
- skipDisabledItems: l.bool
2300
- };
2301
- Mt.defaultProps = {
2302
- ...oe.defaultProps,
2303
- size: "medium",
2304
- rounded: "medium",
2305
- fillMode: "solid",
2306
- skipDisabledItems: !0,
2307
- prefix: void 0,
2308
- suffix: void 0
2309
- };
2310
- const li = Be(), ri = Et(Dt(li, Mt));
2311
- ri.displayName = "KendoReactAutoComplete";
2312
- const di = (i) => i.syntheticEvent.preventDefault(), ci = (i) => i.syntheticEvent.stopPropagation();
2313
- class Is extends o.Component {
2314
- render() {
2315
- const { data: t, guid: e, focused: s, tagRender: n, tag: a, onTagDelete: p, size: c } = this.props;
2316
- return /* @__PURE__ */ o.createElement(o.Fragment, null, t.map((d, r) => {
2317
- const h = a ? /* @__PURE__ */ o.createElement(
2318
- a,
2319
- {
2320
- key: d.text + r,
2321
- tagData: d,
2322
- guid: e,
2323
- focusedTag: s,
2324
- onTagDelete: p
2325
- }
2326
- ) : /* @__PURE__ */ o.createElement(
2327
- Vs,
2328
- {
2329
- id: `tag-${e}-${d.text.replace(/\s+/g, "-")}`,
2330
- "aria-selected": !0,
2331
- role: "option",
2332
- "aria-setsize": t.length,
2333
- key: d.text + r,
2334
- text: d.text,
2335
- removable: !0,
2336
- onRemove: (u) => p.call(void 0, d.data, u.syntheticEvent),
2337
- onMouseDown: di,
2338
- onClick: ci,
2339
- className: d === s ? "k-focus" : void 0,
2340
- size: c
2341
- }
2342
- );
2343
- return n ? n(d, h) : h;
2344
- }), this.props.children);
2345
- }
2346
- }
2347
- var st = /* @__PURE__ */ ((i) => (i[i.PopupList = 0] = "PopupList", i[i.TagsList = 1] = "TagsList", i))(st || {});
2348
- const rs = 500, ts = (i) => {
2349
- const {
2350
- footer: t,
2351
- children: e,
2352
- windowWidth: s = 0,
2353
- navigatable: n,
2354
- navigatableElements: a,
2355
- expand: p,
2356
- animation: c,
2357
- onClose: d,
2358
- adaptiveTitle: r,
2359
- mobileFilter: h
2360
- } = i, u = {
2361
- navigatable: n || !1,
2362
- navigatableElements: a || [],
2363
- expand: p,
2364
- animation: c !== !1,
2365
- onClose: d,
2366
- animationStyles: s <= rs ? { top: 0, width: "100%", height: "100%" } : void 0,
2367
- className: s <= rs ? "k-adaptive-actionsheet k-actionsheet-fullscreen" : "k-adaptive-actionsheet k-actionsheet-bottom"
2368
- };
2369
- return /* @__PURE__ */ o.createElement(Jt, { ...u }, /* @__PURE__ */ o.createElement(Qt, { className: "k-text-center" }, /* @__PURE__ */ o.createElement("div", { className: "k-actionsheet-titlebar-group k-hbox" }, /* @__PURE__ */ o.createElement("div", { className: "k-actionsheet-title" }, /* @__PURE__ */ o.createElement("div", null, r)), /* @__PURE__ */ o.createElement("div", { className: "k-actionsheet-actions" }, /* @__PURE__ */ o.createElement(
2370
- Te,
2371
- {
2372
- tabIndex: 0,
2373
- "aria-label": "Cancel",
2374
- "aria-disabled": "false",
2375
- type: "button",
2376
- fillMode: "flat",
2377
- icon: "x",
2378
- svgIcon: at,
2379
- onClick: d
2380
- }
2381
- ))), h && /* @__PURE__ */ o.createElement("div", { className: "k-actionsheet-titlebar-group k-actionsheet-filter" }, h)), e, t && /* @__PURE__ */ o.createElement(Bs, { className: "k-actions k-actions-stretched" }, /* @__PURE__ */ o.createElement(
2382
- Te,
2383
- {
2384
- size: "large",
2385
- tabIndex: 0,
2386
- "aria-label": t.cancelText,
2387
- "aria-disabled": "false",
2388
- type: "button",
2389
- onClick: t.onCancel
2390
- },
2391
- t.cancelText
2392
- ), /* @__PURE__ */ o.createElement(
2393
- Te,
2394
- {
2395
- tabIndex: 0,
2396
- themeColor: "primary",
2397
- size: "large",
2398
- "aria-label": t.applyText,
2399
- "aria-disabled": "false",
2400
- type: "button",
2401
- onClick: t.onApply
2402
- },
2403
- t.applyText
2404
- )));
2405
- }, { sizeMap: It, roundedMap: pi } = Ge, hi = "Please enter a valid value!", ds = (i) => i.preventDefault(), cs = (i) => i === 2, $t = class extends o.Component {
2406
- constructor(i) {
2407
- super(i), this.state = {
2408
- activedescendant: st.PopupList,
2409
- currentValue: []
2410
- }, this._element = null, this._valueItemsDuringOnChange = null, this.base = new oe(this), this._tags = [], this._input = null, this._adaptiveInput = null, this._skipFocusEvent = !1, this._lastSelectedOrDeslectedItemIndex = null, this.itemHeight = 0, this.scrollToFocused = !1, this.localization = null, this.focus = () => {
2411
- this._input && this._input.focus();
2412
- }, this.handleItemSelect = (t, e) => {
2413
- const { data: s = [], dataItemKey: n, virtual: a } = this.props, p = a ? a.skip : 0, c = s[t - p], d = this.value.findIndex((u) => R(u, c, n));
2414
- this._lastSelectedOrDeslectedItemIndex = s.findIndex((u) => R(u, c, n));
2415
- let r = [];
2416
- d !== -1 ? (r = this.value, r.splice(d, 1)) : r = [...this.value, c], (this.props.filter !== void 0 ? this.props.filter : this.state.text) && !this.mobileMode && (this.state.text && (e.data.text = ""), this.base.filterChanged("", e)), this._adaptiveInput && this._adaptiveInput.blur(), this.state.focusedIndex !== void 0 && (e.data.focusedIndex = void 0), this.triggerOnChange(r, e), this.base.triggerPageChangeCornerItems(c, e);
2417
- }, this.onTagDelete = (t, e) => {
2418
- const s = this.base.initState();
2419
- s.syntheticEvent = e, this.opened && this.base.togglePopup(s), !this.state.focused && !this.mobileMode && (s.data.focused = !0, this.focus());
2420
- const n = this.value;
2421
- bt(n, t, this.props.dataItemKey), this.triggerOnChange(n, s), this.applyState(s);
2422
- }, this.itemFocus = (t, e) => {
2423
- const { data: s = [], allowCustom: n, virtual: a } = this.props, p = a ? a.skip : 0, c = this.props.filter !== void 0 ? this.props.filter : this.state.text, { focusedIndex: d } = this.getFocusedState(), r = n && c, h = s[t - p];
2424
- h && d !== t ? this.state.focusedIndex !== t && (e.data.focusedIndex = t, e.data.activedescendant = st.PopupList) : r && t === -1 && this.state.focusedIndex !== void 0 && (e.data.focusedIndex = void 0), this.base.triggerPageChangeCornerItems(h, e);
2425
- }, this.componentRef = (t) => {
2426
- this._element = t, this.base.wrapper = t;
2427
- }, this.searchbarRef = (t) => {
2428
- const e = this._input = t && t.input;
2429
- e && this.state.focused && window.setTimeout(() => e.focus(), 0);
2430
- }, this.onChangeHandler = (t) => {
2431
- const e = this.base.initState(), s = t.target.value;
2432
- e.syntheticEvent = t, this.props.filter === void 0 && (e.data.text = s), e.data.focusedIndex = void 0, this.opened || (this.base.togglePopup(e), this.setState({ currentValue: this.value })), this.base.filterChanged(s, e), this.applyState(e), this.setState({ group: void 0 });
2433
- }, this.clearButtonClick = (t) => {
2434
- const e = this.base.initState();
2435
- e.syntheticEvent = t, t.stopPropagation(), this.value.length > 0 && this.triggerOnChange([], e), this.state.focusedIndex !== void 0 && (e.data.focusedIndex = void 0), this.opened && this.base.togglePopup(e);
2436
- const s = this.props.filter !== void 0 ? this.props.filter : this.state.text;
2437
- U(s) && s !== "" && this.base.filterChanged("", e), this.state.text && (e.data.text = ""), this._lastSelectedOrDeslectedItemIndex = null, this.applyState(e);
2438
- }, this.onInputKeyDown = (t) => {
2439
- const { data: e = [], textField: s, groupField: n } = this.props, a = t.keyCode, p = this.props.filter !== void 0 ? this.props.filter : this.state.text, c = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { focusedItem: d, focusedIndex: r } = this.getFocusedState(), h = this.base.initState();
2440
- if (h.syntheticEvent = t, !p && this.value.length > 0 && (a === g.left || a === g.right || a === g.home || a === g.end || a === g.delete || a === g.backspace) && !t.shiftKey)
2441
- return this.onTagsNavigate(t, h);
2442
- const u = () => {
2443
- t.preventDefault(), this.base.togglePopup(h), this.applyState(h);
2444
- };
2445
- if (this.opened)
2446
- if (a === g.pageUp)
2447
- this.base.scrollPopupByPageSize(-1);
2448
- else if (a === g.pageDown)
2449
- this.base.scrollPopupByPageSize(1);
2450
- else if ((t.ctrlKey || t.metaKey) && t.code === "KeyA") {
2451
- const m = (this.state.value && this.state.value.length) === e.length ? [] : e;
2452
- this.updateStateOnKeyboardNavigation(m, h);
2453
- } else if ((t.ctrlKey || t.metaKey) && t.shiftKey && t.keyCode === g.end) {
2454
- const f = e.slice(this.getFocusedState().focusedIndex);
2455
- this.itemFocus(e.length - 1, h), this.updateStateOnKeyboardNavigation(f, h);
2456
- } else if ((t.ctrlKey || t.metaKey) && t.shiftKey && t.keyCode === g.home) {
2457
- const f = e.slice(0, this.getFocusedState().focusedIndex + 1);
2458
- this.itemFocus(0, h), this.updateStateOnKeyboardNavigation(f, h);
2459
- } else if (t.shiftKey && t.keyCode === g.up) {
2460
- let f;
2461
- const m = this.getLastSelectedOrDeselectedIndex(1, r);
2462
- m === null ? f = r !== 0 ? e.slice(r - 1, r) : [e[r]] : m === r ? f = [e[m - 1]] : r >= 0 && (f = m > r ? e.slice(r - 1, m) : e.slice(m - 1, r)), f && f.length > 0 && (r >= 1 && this.itemFocus(r - 1, h), this.updateStateOnKeyboardNavigation(f, h));
2463
- } else if (t.shiftKey && t.keyCode === g.down) {
2464
- let f;
2465
- const m = this.getLastSelectedOrDeselectedIndex(0, r);
2466
- m === null ? f = r !== e.length - 1 ? e.slice(r, r + 1) : [e[r]] : m === r ? f = e.slice(r, r + 2) : r >= 0 && (f = m > r ? e.slice(r + 1, m + 1) : e.slice(m, r + 2)), f && f.length >= 1 && (this.itemFocus(r + 1, h), this.updateStateOnKeyboardNavigation(f, h));
2467
- } else if (t.altKey && a === g.up)
2468
- u();
2469
- else if (a === g.up || a === g.down) {
2470
- if (n !== "" && s)
2471
- if (!this.props.skipDisabledItems && c)
2472
- this.onNavigate(h, a);
2473
- else {
2474
- let f = 0;
2475
- if (a === g.down || a === g.right) {
2476
- const m = e.slice(r + 1).find((v) => !v.disabled && v[s]);
2477
- f = m && e.findIndex((v) => v[s] === m[s]);
2478
- } else if (a === g.up || a === g.left) {
2479
- let m;
2480
- if (r === -1)
2481
- m = e, f = e.findIndex((v) => !v.disabled && v[s]);
2482
- else {
2483
- m = e.slice(0, r);
2484
- let v = m.pop();
2485
- for (; v && v.disabled; )
2486
- v = m.pop();
2487
- f = v && e.findIndex((b) => b[s] === v[s]);
2488
- }
2489
- }
2490
- if (f) {
2491
- const m = f - r;
2492
- this.onNavigate(h, a, m);
2493
- } else
2494
- f !== void 0 && this.onNavigate(h, a);
2495
- }
2496
- else if (!this.props.skipDisabledItems && c)
2497
- this.onNavigate(h, a);
2498
- else {
2499
- let f = null;
2500
- if (a === g.down || a === g.right)
2501
- f = e.slice(r + 1).find((m) => !m.disabled);
2502
- else if (a === g.up || a === g.left) {
2503
- const m = e.slice(0, r);
2504
- for (f = m.pop(); f && f.disabled; )
2505
- f = m.pop();
2506
- }
2507
- if (f) {
2508
- const m = f.id - r - 1;
2509
- this.onNavigate(h, a, m);
2510
- } else
2511
- this.onNavigate(h, a);
2512
- }
2513
- this.applyState(h), t.preventDefault();
2514
- } else
2515
- a === g.enter ? (t.preventDefault(), this.props.allowCustom && p && d === null ? this.customItemSelect(t) : d && d.disabled ? u() : this.selectFocusedItem(t)) : a === g.esc && u();
2516
- else
2517
- t.altKey && a === g.down && u();
2518
- }, this.listContainerContent = () => {
2519
- const { header: t, footer: e, allowCustom: s, size: n, data: a = [], groupStickyHeaderItemRender: p, groupField: c, list: d } = this.props, r = this.props.filter !== void 0 ? this.props.filter : this.state.text, { focusedType: h } = this.getFocusedState(), u = s && r && /* @__PURE__ */ o.createElement(
2520
- "div",
2521
- {
2522
- className: B("k-list", {
2523
- [`k-list-${It[n] || n}`]: n
2524
- }),
2525
- key: "customitem",
2526
- onClick: this.customItemSelect,
2527
- onMouseDown: ds
2528
- },
2529
- /* @__PURE__ */ o.createElement(
2530
- "div",
2531
- {
2532
- className: B("k-list-item k-custom-item", { "k-focus": cs(h) }),
2533
- style: { fontStyle: "italic" }
2534
- },
2535
- r,
2536
- /* @__PURE__ */ o.createElement(Ce, { name: "plus", icon: Os, style: { position: "absolute", right: "0.5em" } })
2537
- )
2538
- );
2539
- let { group: f } = this.state;
2540
- return f === void 0 && c !== void 0 && (f = V(a[0], c)), /* @__PURE__ */ o.createElement(o.Fragment, null, t && /* @__PURE__ */ o.createElement("div", { className: "k-list-header" }, t), u, /* @__PURE__ */ o.createElement(
2541
- "div",
2542
- {
2543
- className: B(
2544
- "k-list",
2545
- {
2546
- [`k-list-${this.mobileMode ? "lg" : It[n] || n}`]: n,
2547
- "k-virtual-list": this.base.vs.enabled
2548
- }
2549
- )
2550
- },
2551
- !d && f && a.length !== 0 && /* @__PURE__ */ o.createElement(qe, { group: f, groupMode: "modern", render: p }),
2552
- this.renderList()
2553
- ), e && /* @__PURE__ */ o.createElement("div", { className: "k-list-footer" }, e));
2554
- }, this.renderListContainer = () => {
2555
- const t = this.base, { dir: e, data: s = [] } = this.props, n = this.base.getPopupSettings(), a = n.width !== void 0 ? n.width : t.popupWidth, p = {
2556
- dir: e !== void 0 ? e : t.dirCalculated,
2557
- width: a,
2558
- popupSettings: {
2559
- ...n,
2560
- popupClass: B(
2561
- n.popupClass,
2562
- "k-list-container",
2563
- "k-multiselect-popup"
2564
- ),
2565
- anchor: n.anchor || this.element,
2566
- show: this.opened,
2567
- onOpen: this.onPopupOpened,
2568
- onClose: this.onPopupClosed
2569
- },
2570
- itemsCount: [s.length, this.value.length]
2571
- };
2572
- return /* @__PURE__ */ o.createElement(Ft, { ...p }, this.listContainerContent());
2573
- }, this.renderAdaptiveListContainer = () => {
2574
- const { adaptiveTitle: t, filterable: e, filter: s } = this.props, { windowWidth: n = 0 } = this.state, a = s !== void 0 ? s : this.state.text;
2575
- this.localization = We(this);
2576
- const p = e ? /* @__PURE__ */ o.createElement(
2577
- Re,
2578
- {
2579
- value: a,
2580
- ref: (d) => this._adaptiveInput = d && d.element,
2581
- onChange: this.onChangeHandler,
2582
- onKeyDown: this.onInputKeyDown,
2583
- size: this.props.size,
2584
- rounded: this.props.rounded,
2585
- fillMode: this.props.fillMode
2586
- }
2587
- ) : null, c = {
2588
- adaptiveTitle: t,
2589
- expand: this.opened,
2590
- onClose: (d) => this.onCancel(d),
2591
- windowWidth: n,
2592
- mobileFilter: p,
2593
- footer: {
2594
- cancelText: this.localization.toLanguageString(ot, ce[ot]),
2595
- onCancel: this.onCancel,
2596
- applyText: this.localization.toLanguageString(nt, ce[nt]),
2597
- onApply: this.closePopup
2598
- }
2599
- };
2600
- return /* @__PURE__ */ o.createElement(ts, { ...c }, /* @__PURE__ */ o.createElement(lt, { className: "!k-overflow-hidden" }, /* @__PURE__ */ o.createElement("div", { className: "k-list-container" }, this.listContainerContent())));
2601
- }, this.closePopup = (t) => {
2602
- const e = this.base.initState();
2603
- e.syntheticEvent = t, t.stopPropagation(), this.state.focusedIndex !== void 0 && (e.data.focusedIndex = void 0), this.opened && this.base.togglePopup(e), e.events.push({ type: "onClose" });
2604
- const s = this.props.filter !== void 0 ? this.props.filter : this.state.text;
2605
- U(s) && s !== "" && this.base.filterChanged("", e), this.state.text && (e.data.text = ""), this.applyState(e);
2606
- }, this.onCancel = (t) => {
2607
- const e = this.base.initState();
2608
- e.syntheticEvent = t, t.stopPropagation(), this.state.focusedIndex !== void 0 && (e.data.focusedIndex = void 0), this.opened && this.base.togglePopup(e), e.events.push({ type: "onCancel" });
2609
- const s = this.props.filter !== void 0 ? this.props.filter : this.state.text;
2610
- U(s) && s !== "" && this.base.filterChanged("", e), this.state.text && (e.data.text = ""), this.applyState(e);
2611
- }, this.renderList = () => {
2612
- const {
2613
- data: t = [],
2614
- textField: e,
2615
- listNoDataRender: s,
2616
- itemRender: n,
2617
- groupHeaderItemRender: a,
2618
- dataItemKey: p,
2619
- virtual: c = { skip: 0, total: void 0 }
2620
- } = this.props, d = this.base.vs, { focusedIndex: r } = this.getFocusedState(), h = this.base.getPopupSettings(), u = `translateY(${d.translate}px)`;
2621
- return /* @__PURE__ */ o.createElement(
2622
- je,
2623
- {
2624
- id: this.base.listBoxId,
2625
- show: this.opened,
2626
- data: t.slice(),
2627
- focusedIndex: r - c.skip,
2628
- value: this.value,
2629
- textField: e,
2630
- valueField: p,
2631
- optionsGuid: this.base.guid,
2632
- groupField: this.props.groupField,
2633
- groupMode: "modern",
2634
- listRef: (f) => {
2635
- d.list = this.base.list = f;
2636
- },
2637
- wrapperStyle: this.mobileMode ? {} : { maxHeight: h.height },
2638
- wrapperCssClass: "k-list-content",
2639
- listStyle: d.enabled ? { transform: u } : void 0,
2640
- key: "listKey",
2641
- skip: c.skip,
2642
- onClick: this.handleItemClick,
2643
- itemRender: n,
2644
- groupHeaderItemRender: a,
2645
- noDataRender: s,
2646
- onMouseDown: ds,
2647
- onBlur: this.handleBlur,
2648
- onScroll: this.onScroll,
2649
- wrapperRef: d.scrollerRef,
2650
- scroller: this.base.renderScrollElement(),
2651
- ariaSetSize: c.total
2652
- }
2653
- );
2654
- }, this.onScroll = (t) => {
2655
- const { vs: e, list: s } = this.base;
2656
- e.scrollHandler(t);
2657
- const { groupField: n } = this.props;
2658
- let { data: a = [] } = this.props;
2659
- if (!(!n || !a.length) && n) {
2660
- const p = this.itemHeight = this.itemHeight || (e.enabled ? e.itemHeight : s ? s.children[0].offsetHeight : 0), d = t.target.scrollTop - e.skip * p;
2661
- a = this.base.getGroupedDataModernMode(a, n);
2662
- let r = a[0][n];
2663
- for (let h = 1; h < a.length && !(p * h > d); h++)
2664
- a[h] && a[h][n] && (r = a[h][n]);
2665
- r !== this.state.group && this.setState({
2666
- group: r
2667
- });
2668
- }
2669
- }, this.customItemSelect = (t) => {
2670
- const e = this.props.filter !== void 0 ? this.props.filter : this.state.text, { textField: s } = this.props;
2671
- if (!e)
2672
- return;
2673
- const n = this.base.initState();
2674
- n.syntheticEvent = t;
2675
- const a = s ? { [s]: e } : e;
2676
- this.state.text !== void 0 && (n.data.text = ""), n.data.focusedIndex = void 0, this.base.filterChanged("", n);
2677
- const p = [...this.value, a];
2678
- this.triggerOnChange(p, n), this.base.togglePopup(n), this.applyState(n);
2679
- }, this.handleWrapperClick = (t) => {
2680
- const e = this._input;
2681
- !this.opened && e && this.focusElement(e);
2682
- const s = this.base.initState();
2683
- s.syntheticEvent = t, !this.state.focused && !this.mobileMode && (s.events.push({ type: "onFocus" }), s.data.focused = !0), this.mobileMode && (this.setState({ currentValue: this.tagsToRender }), this.mobileMode && window.setTimeout(() => this._adaptiveInput && this._adaptiveInput.focus(), 300)), this.base.togglePopup(s), this.applyState(s);
2684
- }, this.handleItemClick = (t, e) => {
2685
- const s = this.base.initState();
2686
- s.syntheticEvent = e, this.handleItemSelect(t, s), this.props.autoClose && !this.mobileMode && this.base.togglePopup(s), e.stopPropagation(), this.applyState(s);
2687
- }, this.handleBlur = (t) => {
2688
- if (!this.state.focused || this._skipFocusEvent)
2689
- return;
2690
- const e = this.base.initState(), { allowCustom: s, filterable: n } = this.props;
2691
- e.syntheticEvent = t, e.data.focused = !1, e.events.push({ type: "onBlur" }), this.opened && !this.mobileMode && (this.state.opened && (e.data.opened = !1), e.events.push({ type: "onClose" })), !s && !n && this.state.text && (e.data.text = ""), this.applyState(e);
2692
- }, this.handleFocus = (t) => {
2693
- this._skipFocusEvent || this.base.handleFocus(t);
2694
- }, this.onPopupOpened = () => {
2695
- this._input && this.state.focused && !this.mobileMode && this.focusElement(this._input);
2696
- }, this.onPopupClosed = () => {
2697
- this.state.focused && window.setTimeout(() => {
2698
- this.state.focused && this.focusElement(this._input);
2699
- }, 0);
2700
- }, this.setValidity = () => {
2701
- this._input && this._input.setCustomValidity && this._input.setCustomValidity(
2702
- this.validity.valid ? "" : this.props.validationMessage || hi
2703
- );
2704
- }, $e(Ye);
2705
- }
2706
- get _inputId() {
2707
- return this.props.id;
2708
- }
2709
- get document() {
2710
- if (Me)
2711
- return this.element && this.element.ownerDocument || document;
2712
- }
2713
- /** @hidden */
2714
- get element() {
2715
- return this._element;
2716
- }
2717
- /** @hidden */
2718
- get opened() {
2719
- return !!(this.props.opened !== void 0 ? this.props.opened : this.state.opened);
2720
- }
2721
- /** @hidden */
2722
- get tagsToRender() {
2723
- const { tags: i, textField: t } = this.props;
2724
- let e = [];
2725
- return i === void 0 ? this.value.forEach((s) => {
2726
- e.push({ text: V(s, t), data: [s] });
2727
- }) : e.push(...i), e;
2728
- }
2729
- /**
2730
- * The mobile mode of the ComboBox.
2731
- */
2732
- get mobileMode() {
2733
- return !!(this.state.windowWidth && this.state.windowWidth <= Ee && this.props.adaptive);
2734
- }
2735
- /**
2736
- * Represents the value of the MultiSelect.
2737
- */
2738
- get value() {
2739
- const i = [];
2740
- return this._valueItemsDuringOnChange ? i.push(...this._valueItemsDuringOnChange) : this.props.value ? i.push(...this.props.value) : this.state.value ? i.push(...this.state.value) : this.props.defaultValue && i.push(...this.props.defaultValue), i;
2741
- }
2742
- /**
2743
- * Gets the `name` property of the MultiSelect.
2744
- */
2745
- get name() {
2746
- return this.props.name;
2747
- }
2748
- /**
2749
- * Represents the validity state into which the MultiSelect is set.
2750
- */
2751
- get validity() {
2752
- const i = this.props.validationMessage !== void 0, t = !this.required || this.value !== null && this.value.length > 0 && this.value !== void 0, e = this.props.valid !== void 0 ? this.props.valid : t;
2753
- return {
2754
- customError: i,
2755
- valid: e,
2756
- valueMissing: this.value === null
2757
- };
2758
- }
2759
- /** @hidden */
2760
- get required() {
2761
- return this.props.required !== void 0 ? this.props.required : $t.defaultProps.required;
2762
- }
2763
- get validityStyles() {
2764
- return this.props.validityStyles !== void 0 ? this.props.validityStyles : $t.defaultProps.validityStyles;
2765
- }
2766
- /** @hidden */
2767
- componentDidUpdate(i, t) {
2768
- var u;
2769
- const { virtual: e, groupField: s = "", data: n = [] } = this.props, a = e ? e.skip : 0, p = i.virtual ? i.virtual.total : 0, c = i.opened !== void 0 ? i.opened : t.opened, d = !c && this.opened, r = c && !this.opened;
2770
- if (!this.base.getPopupSettings().animate && r && this.onPopupClosed(), e && e.total !== p)
2771
- this.base.vs.calcScrollElementHeight(), this.base.vs.reset();
2772
- else {
2773
- let { focusedItem: f, focusedIndex: m } = this.getFocusedState();
2774
- s !== "" && (m = (u = this.base.getGroupedDataModernMode(n, s)) == null ? void 0 : u.indexOf(f)), d && e ? this.base.scrollToVirtualItem(e, m - a) : d && !e ? (n && n.length !== 0 && this.base.resetGroupStickyHeader(n[0][s], this), this.base.scrollToItem(m)) : this.opened && c && f && this.scrollToFocused && this.base.scrollToItem(m - a);
2775
- }
2776
- this.scrollToFocused = !1, this.setValidity();
2777
- }
2778
- /** @hidden */
2779
- componentDidMount() {
2780
- var i;
2781
- this.observerResize = Me && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this)), this.base.didMount(), this.setValidity(), (i = this.document) != null && i.body && this.observerResize && this.observerResize.observe(this.document.body);
2782
- }
2783
- /** @hidden */
2784
- componentWillUnmount() {
2785
- var i;
2786
- (i = this.document) != null && i.body && this.observerResize && this.observerResize.disconnect();
2787
- }
2788
- /** @hidden */
2789
- onNavigate(i, t, e) {
2790
- const { allowCustom: s, data: n = [] } = this.props, a = this.props.filter !== void 0 ? this.props.filter : this.state.text, { focusedType: p, focusedIndex: c } = this.getFocusedState(), d = s && a, r = cs(p), h = this.base, u = h.vs;
2791
- if (this.opened && t === g.up && r)
2792
- this.state.focusedIndex !== void 0 && (i.data.focusedIndex = void 0);
2793
- else {
2794
- const f = h.navigation.navigate({
2795
- keyCode: t,
2796
- current: c,
2797
- max: (u.enabled ? u.total : n.length) - 1,
2798
- min: d ? -1 : 0,
2799
- skipItems: e || void 0
2800
- });
2801
- f !== void 0 && (this.itemFocus(f, i), this.scrollToFocused = !0);
2802
- }
2803
- this.applyState(i);
2804
- }
2805
- /** @hidden */
2806
- render() {
2807
- const {
2808
- style: i,
2809
- className: t,
2810
- label: e,
2811
- dir: s,
2812
- disabled: n,
2813
- textField: a,
2814
- dataItemKey: p,
2815
- virtual: c,
2816
- size: d,
2817
- rounded: r,
2818
- fillMode: h,
2819
- loading: u,
2820
- filter: f
2821
- } = this.props, { text: m, focused: v, focusedTag: b, currentValue: w } = this.state, k = this.base.vs, D = this.props.id || this._inputId;
2822
- k.enabled = c !== void 0, c !== void 0 && (k.skip = c.skip, k.total = c.total, k.pageSize = c.pageSize);
2823
- const O = this.mobileMode && this.opened ? w : this.tagsToRender;
2824
- this.setItems(this.tagsToRender, this._tags);
2825
- const N = !this.validityStyles || this.validity.valid, _ = !!(f !== void 0 ? f : m) || O && O.length > 0, [S, F] = Ne(this.props.prefix || o.Fragment), [C, E] = Ne(this.props.suffix || o.Fragment), M = /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(
2826
- "div",
2827
- {
2828
- ref: this.componentRef,
2829
- className: B("k-multiselect k-input", t, {
2830
- [`k-input-${It[d] || d}`]: d,
2831
- [`k-rounded-${pi[r] || r}`]: r,
2832
- [`k-input-${h}`]: h,
2833
- "k-focus": v && !n,
2834
- "k-invalid": !N,
2835
- "k-disabled": n,
2836
- "k-loading": u,
2837
- "k-required": this.required
2838
- }),
2839
- style: e ? { ...i, width: void 0 } : i,
2840
- dir: s,
2841
- onFocus: this.handleFocus,
2842
- onBlur: this.handleBlur,
2843
- onClick: this.handleWrapperClick,
2844
- onMouseDown: Ws
2845
- },
2846
- this.props.prefix && /* @__PURE__ */ o.createElement(S, { ...F }),
2847
- /* @__PURE__ */ o.createElement("div", { className: B("k-input-values") }, /* @__PURE__ */ o.createElement(
2848
- "div",
2849
- {
2850
- className: B(
2851
- "k-chip-list",
2852
- { [`k-chip-list-${It[d] || d}`]: d }
2853
- ),
2854
- role: "listbox",
2855
- id: "tagslist-" + this.base.guid
2856
- },
2857
- O && O.length > 0 && /* @__PURE__ */ o.createElement(
2858
- Is,
2859
- {
2860
- tagRender: this.props.tagRender,
2861
- onTagDelete: this.onTagDelete,
2862
- data: O,
2863
- guid: this.base.guid,
2864
- focused: b ? O.find((A) => St(A, b, p)) : void 0,
2865
- size: d
2866
- }
2867
- )
2868
- ), this.renderSearchBar(D)),
2869
- u && /* @__PURE__ */ o.createElement(Ce, { className: "k-input-loading-icon", name: "loading" }),
2870
- this.props.suffix && /* @__PURE__ */ o.createElement(C, { ...E }),
2871
- _ && /* @__PURE__ */ o.createElement(rt, { onClick: this.clearButtonClick }),
2872
- !this.mobileMode && this.renderListContainer()
2873
- ), this.mobileMode && this.renderAdaptiveListContainer());
2874
- return e ? /* @__PURE__ */ o.createElement(
2875
- Ue,
2876
- {
2877
- label: e,
2878
- editorId: D,
2879
- editorValue: m || V(this.value[0], a),
2880
- editorValid: N,
2881
- editorDisabled: n,
2882
- style: { width: i ? i.width : void 0 },
2883
- children: M
2884
- }
2885
- ) : M;
2886
- }
2887
- renderSearchBar(i) {
2888
- const { activedescendant: t, focusedTag: e, currentValue: s } = this.state, { disabled: n, placeholder: a, ariaDescribedBy: p } = this.props, c = !this.mobileMode && (this.props.filter !== void 0 ? this.props.filter : this.state.text) || "", { focusedIndex: d } = this.getFocusedState(), r = this.value.length === 0 && !c ? a : void 0, h = s && s.length > 0 ? void 0 : a, u = t === st.TagsList && e !== void 0 ? `tag-${this.base.guid}-${e.text.replace(/\s+/g, "-")}` : `option-${this.base.guid}-${d}`;
2889
- return /* @__PURE__ */ o.createElement(
2890
- es,
2891
- {
2892
- id: i,
2893
- size: Math.max((r || "").length, c.length, 1),
2894
- tabIndex: this.props.tabIndex,
2895
- accessKey: this.props.accessKey,
2896
- placeholder: this.mobileMode && this.opened ? h : r,
2897
- value: c,
2898
- onChange: this.onChangeHandler,
2899
- onKeyDown: this.onInputKeyDown,
2900
- ref: this.searchbarRef,
2901
- disabled: n,
2902
- expanded: this.opened,
2903
- owns: this.base.listBoxId,
2904
- role: "combobox",
2905
- activedescendant: u,
2906
- ariaDescribedBy: `tagslist-${this.base.guid}${p ? " " + p : ""}`,
2907
- ariaLabelledBy: this.props.ariaLabelledBy,
2908
- ariaRequired: this.required
2909
- }
2910
- );
2911
- }
2912
- onTagsNavigate(i, t) {
2913
- const e = i.keyCode, { focusedTag: s } = this.state, n = this._tags, a = this.props.dataItemKey;
2914
- let p = s ? n.findIndex((r) => St(r, s, a)) : -1, c;
2915
- const d = p !== -1;
2916
- if (e === g.left)
2917
- d ? p = Math.max(0, p - 1) : p = n.length - 1, c = n[p];
2918
- else if (e === g.right)
2919
- p === n.length - 1 ? c = void 0 : d && (p = Math.min(n.length - 1, p + 1), c = n[p]);
2920
- else if (e === g.home && !i.shiftKey)
2921
- c = n[0];
2922
- else if (e === g.end && !i.shiftKey)
2923
- c = n[n.length - 1];
2924
- else if (e === g.delete) {
2925
- if (d) {
2926
- const r = this.value;
2927
- bt(r, n[p].data, a), this.triggerOnChange(r, t);
2928
- }
2929
- } else if (e === g.backspace) {
2930
- const r = this.value;
2931
- if (d)
2932
- bt(r, n[p].data, a), this.triggerOnChange(r, t);
2933
- else if (!d && n.length) {
2934
- const h = n.pop();
2935
- bt(r, h.data, a), this.triggerOnChange(r, t);
2936
- }
2937
- }
2938
- c !== s && (t.data.focusedTag = c, t.data.activedescendant = st.TagsList), this.applyState(t);
2939
- }
2940
- triggerOnChange(i, t) {
2941
- this.props.value === void 0 && (t.data.value = [...i]), this._valueItemsDuringOnChange = [], this.setItems(i, this._valueItemsDuringOnChange), t.events.push({ type: "onChange" });
2942
- }
2943
- selectFocusedItem(i, t) {
2944
- const { data: e = [], virtual: s } = this.props, { focusedIndex: n } = t || this.getFocusedState(), a = s ? s.skip : 0;
2945
- e[n - a] !== void 0 && this.handleItemClick(n, i);
2946
- }
2947
- setItems(i, t) {
2948
- t.length = 0, t.push(...i);
2949
- }
2950
- getFocusedState() {
2951
- const { focusedIndex: i } = this.state, t = this.props.filter !== void 0 ? this.props.filter : this.state.text, { allowCustom: e, data: s = [], dataItemKey: n, virtual: a, textField: p, focusedItemIndex: c = Ve, skipDisabledItems: d } = this.props, r = a && a.skip || 0;
2952
- let h;
2953
- if (i !== void 0)
2954
- return {
2955
- focusedIndex: i,
2956
- focusedItem: s[i - r],
2957
- focusedType: 1
2958
- /* ListItem */
2959
- };
2960
- const u = this.value;
2961
- if (e && t)
2962
- return {
2963
- focusedItem: null,
2964
- focusedIndex: -1,
2965
- focusedType: 2
2966
- /* CustomItem */
2967
- };
2968
- if (t)
2969
- return h = c(s, t, p), {
2970
- focusedItem: s[h],
2971
- focusedIndex: h + r,
2972
- focusedType: 1
2973
- /* ListItem */
2974
- };
2975
- if (u.length) {
2976
- const f = u[u.length - 1];
2977
- return h = s.findIndex((m) => R(m, f, n)), s[h] !== void 0 ? {
2978
- focusedIndex: h + r,
2979
- focusedItem: s[h],
2980
- focusedType: 1
2981
- /* ListItem */
2982
- } : { focusedType: 0, focusedIndex: -1 };
2983
- } else if (d && p && !t && r === 0) {
2984
- const f = s.findIndex((m) => !m.disabled && m[p]);
2985
- return {
2986
- focusedIndex: f,
2987
- focusedItem: s[f - r],
2988
- focusedType: 1
2989
- /* ListItem */
2990
- };
2991
- }
2992
- return r === 0 ? {
2993
- focusedItem: s[0],
2994
- focusedIndex: 0,
2995
- focusedType: 1
2996
- /* ListItem */
2997
- } : { focusedType: 0, focusedIndex: -1 };
2998
- }
2999
- focusElement(i) {
3000
- this._skipFocusEvent = !0, i.focus(), window.setTimeout(() => this._skipFocusEvent = !1, 0);
3001
- }
3002
- applyState(i) {
3003
- this.base.applyState(i), this._valueItemsDuringOnChange = null;
3004
- }
3005
- calculateMedia(i) {
3006
- for (let t of i)
3007
- this.setState({ windowWidth: t.target.clientWidth });
3008
- }
3009
- /**
3010
- * Updates the state of the MultiSelect when the complex keyboard navigation that
3011
- * includes key combinations with the Ctrl/Command, Shift, Home and End keys
3012
- *
3013
- * @param {Array<string | Object>} dataToSet Defines the array of new values that will be applied to the MultiSelect
3014
- * @param {MultiSelectInternalState} state The current state of the MultiSelect
3015
- */
3016
- updateStateOnKeyboardNavigation(i, t) {
3017
- this.setState({ value: i }), this.triggerOnChange(i, t), this.applyState(t);
3018
- }
3019
- /**
3020
- * Returns the last element that was selected or deselected. Needed for the keyboard navigation specifications
3021
- *
3022
- * @param {number} correction A correction is needed depending on if UP or DOWN key is pressed
3023
- */
3024
- getLastSelectedOrDeselectedIndex(i, t) {
3025
- return this._lastSelectedOrDeslectedItemIndex === null && (this._lastSelectedOrDeslectedItemIndex = t), this._lastSelectedOrDeslectedItemIndex !== null ? this._lastSelectedOrDeslectedItemIndex + i : null;
3026
- }
3027
- };
3028
- let Nt = $t;
3029
- Nt.displayName = "MultiSelect";
3030
- Nt.propTypes = {
3031
- ...oe.propTypes,
3032
- autoClose: l.bool,
3033
- value: l.arrayOf(l.any),
3034
- defaultValue: l.arrayOf(l.any),
3035
- dataItemKey: l.string,
3036
- placeholder: l.string,
3037
- tags: l.arrayOf(l.shape({
3038
- text: l.string,
3039
- data: l.arrayOf(l.any)
3040
- })),
3041
- tagRender: l.func,
3042
- id: l.string,
3043
- ariaLabelledBy: l.string,
3044
- ariaDescribedBy: l.string,
3045
- groupField: l.string,
3046
- list: l.any,
3047
- adaptive: l.bool,
3048
- adaptiveTitle: l.string,
3049
- onCancel: l.func,
3050
- skipDisabledItems: l.bool
3051
- };
3052
- Nt.defaultProps = {
3053
- ...oe.defaultProps,
3054
- autoClose: !0,
3055
- required: !1,
3056
- size: "medium",
3057
- rounded: "medium",
3058
- fillMode: "solid",
3059
- groupMode: "modern",
3060
- skipDisabledItems: !0,
3061
- prefix: void 0,
3062
- suffix: void 0
3063
- };
3064
- const ui = Be(), fi = Et(Dt(ui, Nt));
3065
- fi.displayName = "KendoReactMultiSelect";
3066
- const gi = (i) => /* @__PURE__ */ o.createElement(
3067
- je,
3068
- {
3069
- ...i,
3070
- wrapperCssClass: "k-table-body k-table-scroller",
3071
- listClassName: B(
3072
- "k-table k-table-list",
3073
- {
3074
- "k-virtual-table": i.virtual !== void 0
3075
- }
3076
- ),
3077
- listStyle: { ...i.listStyle }
3078
- }
3079
- ), mi = (i, t) => i ? typeof i == "number" ? i + "px" : i : t, vi = Be(), ss = o.forwardRef((i, t) => {
3080
- const e = Ut(vi, i), s = o.useRef(null), n = o.useRef(null), a = Ds(), {
3081
- columns: p = Ae.columns,
3082
- popupSettings: c = Ae.popupSettings,
3083
- className: d,
3084
- size: r,
3085
- prefix: h = void 0,
3086
- suffix: u = void 0,
3087
- onOpen: f,
3088
- onClose: m,
3089
- onFocus: v,
3090
- onBlur: b,
3091
- onChange: w,
3092
- onFilterChange: k,
3093
- onPageChange: D,
3094
- ...O
3095
- } = e;
3096
- o.useImperativeHandle(s, () => ({
3097
- element: n.current && n.current.element,
3098
- focus() {
3099
- n.current && n.current.focus();
3100
- },
3101
- get value() {
3102
- return n.current && n.current.value;
3103
- },
3104
- get name() {
3105
- return n.current && n.current.name;
3106
- },
3107
- props: e
3108
- })), o.useImperativeHandle(t, () => s.current);
3109
- const N = o.useMemo(
3110
- () => {
3111
- if (e.groupField !== void 0 && e.data)
3112
- return V(e.data[0], e.groupField);
3113
- },
3114
- [e.data, e.groupField]
3115
- ), [_, S] = o.useState(N), [F, C] = o.useState(!0), [E] = h ? Ne(e.prefix || o.Fragment) : [], [M] = u ? Ne(e.suffix || o.Fragment) : [], A = o.useMemo(
3116
- () => {
3117
- const P = /* @__PURE__ */ o.createElement("th", { className: "k-table-th", colSpan: p.length }, _);
3118
- return /* @__PURE__ */ o.createElement(o.Fragment, null, e.header, /* @__PURE__ */ o.createElement("div", { className: "k-table-header-wrap" }, /* @__PURE__ */ o.createElement("table", { className: "k-table", role: "presentation" }, /* @__PURE__ */ o.createElement("colgroup", null, p.map(
3119
- (W, ge) => /* @__PURE__ */ o.createElement(
3120
- "col",
3121
- {
3122
- key: W.uniqueKey ? W.uniqueKey : ge,
3123
- style: { width: W.width ? W.width : Ae.width }
3124
- }
3125
- )
3126
- )), /* @__PURE__ */ o.createElement("thead", { className: "k-table-thead" }, /* @__PURE__ */ o.createElement("tr", { className: "k-table-row" }, p.map((W, ge) => /* @__PURE__ */ o.createElement("th", { className: "k-table-th", key: W.uniqueKey ? W.uniqueKey : ge }, W.header || " "))), _ && F && /* @__PURE__ */ o.createElement("tr", { className: "k-table-group-row" }, e.groupStickyHeaderItemRender ? e.groupStickyHeaderItemRender.call(void 0, P, {}) : P)))));
3127
- },
3128
- [e.header, p, _, F]
3129
- ), j = o.useMemo(
3130
- () => (
3131
- // These additional 4px are coming from the child elements side borders (fixes horizontal scrollbar)
3132
- `calc(${p.map((P) => mi(P.width, Ae.width)).filter(Boolean).join(" + ")} + ${a}px + 4px)`
3133
- ),
3134
- [p, a]
3135
- ), Y = e.virtual ? e.virtual.skip : 0, Z = o.useCallback(
3136
- (P, W) => {
3137
- const ge = p.map((ee, ct) => /* @__PURE__ */ o.createElement(
3138
- "span",
3139
- {
3140
- className: e.itemRender ? void 0 : "k-table-td",
3141
- style: e.itemRender ? void 0 : { width: ee.width ? ee.width : Ae.width },
3142
- key: ee.uniqueKey ? ee.uniqueKey : ct
3143
- },
3144
- ee.field ? String(Ct(ee.field)(W.dataItem)) : ""
3145
- ));
3146
- let z, J, ke, le, q = e.data || [];
3147
- const re = W.index - Y;
3148
- e.groupField !== void 0 && (le = Ct(e.groupField), J = le(q[re]), ke = le(q[re - 1]), J && ke && J !== ke && (z = J)), z && e.groupMode === "classic" && ge.push(/* @__PURE__ */ o.createElement("div", { key: "group", className: "k-table-td k-table-group-td" }, /* @__PURE__ */ o.createElement("span", null, z)));
3149
- const Se = o.cloneElement(P, {
3150
- ...P.props,
3151
- className: B("k-table-row", {
3152
- "k-table-alt-row": W.index % 2 !== 0,
3153
- "k-focus": W.focused,
3154
- "k-selected": W.selected,
3155
- "k-first": !!z,
3156
- "k-disabled": W.dataItem.disabled
3157
- })
3158
- }, ge);
3159
- return e.itemRender ? e.itemRender.call(void 0, Se, W) : Se;
3160
- },
3161
- [p, e.groupField, e.itemRender, e.data, Y]
3162
- ), K = o.useCallback(
3163
- (P, W) => {
3164
- P && P.call(void 0, {
3165
- ...W,
3166
- target: s.current
3167
- });
3168
- },
3169
- []
3170
- ), be = o.useCallback((P) => (e.virtual || S(N), K(f, P)), [K, f, e.virtual, N]), X = o.useCallback((P) => K(m, P), [m]), Q = o.useCallback((P) => K(v, P), [v]), ae = o.useCallback((P) => K(b, P), [b]), Ke = o.useCallback((P) => K(w, P), [w]), Oe = o.useCallback((P) => K(D, P), [D]), Le = o.useCallback((P) => (S(N), K(k, {
3171
- ...P,
3172
- mobileMode: P.target.mobileMode
3173
- })), [k]), H = o.useCallback(
3174
- (P) => {
3175
- S(P.group);
3176
- },
3177
- []
3178
- );
3179
- o.useEffect(() => {
3180
- Fs();
3181
- }), o.useEffect(() => {
3182
- const P = e.data;
3183
- S(N), P && P.length !== 0 ? C(!0) : C(!1);
3184
- }, [e.data]);
3185
- const ze = o.useCallback((P) => /* @__PURE__ */ o.createElement(gi, { ...P }), []);
3186
- return /* @__PURE__ */ o.createElement(
3187
- Ps.Provider,
3188
- {
3189
- value: (P) => ({ ...P, popupClass: `k-dropdowngrid-popup ${c.popupClass}` })
3190
- },
3191
- /* @__PURE__ */ o.createElement(
3192
- ys,
3193
- {
3194
- ...O,
3195
- list: ze,
3196
- popupSettings: {
3197
- ...c,
3198
- width: c.width || j,
3199
- className: c.className
3200
- },
3201
- ref: n,
3202
- header: A,
3203
- itemRender: Z,
3204
- groupHeaderItemRender: e.groupHeaderItemRender,
3205
- size: e.size,
3206
- rounded: e.rounded,
3207
- fillMode: e.fillMode,
3208
- groupMode: e.groupMode,
3209
- groupField: e.groupField,
3210
- isMultiColumn: !0,
3211
- onOpen: be,
3212
- onClose: X,
3213
- onFocus: Q,
3214
- onBlur: ae,
3215
- onChange: Ke,
3216
- onFilterChange: Le,
3217
- onPageChange: Oe,
3218
- onGroupScroll: H,
3219
- className: B("k-dropdowngrid", d),
3220
- required: e.required,
3221
- adaptive: e.adaptive,
3222
- adaptiveFilter: e.adaptiveFilter,
3223
- adaptiveTitle: e.adaptiveTitle,
3224
- footer: e.footer,
3225
- footerClassName: "k-table-footer",
3226
- prefix: E,
3227
- suffix: M
3228
- }
3229
- )
3230
- );
3231
- }), bi = {
3232
- ...dt.propTypes,
3233
- columns: l.any.isRequired
3234
- }, Ae = {
3235
- columns: [],
3236
- popupSettings: {},
3237
- width: "200px",
3238
- size: "medium",
3239
- rounded: "medium",
3240
- fillMode: "solid"
3241
- };
3242
- ss.displayName = "KendoMultiColumnComboBox";
3243
- ss.propTypes = bi;
3244
- ss.defaultProps = Ae;
3245
- function yi(i, t, e) {
3246
- const [s, n] = o.useState(t);
3247
- return o.useEffect(
3248
- () => {
3249
- s !== void 0 && i.current && n(i.current.offsetWidth);
3250
- },
3251
- e
3252
- ), s;
3253
- }
3254
- function xs(i, t, e, s) {
3255
- const n = e.width !== void 0 && e.width !== t.popupSettings.width, a = s.width !== void 0, p = n ? e.width : a ? s.width : t.popupSettings.width, c = yi(i, p);
3256
- return n || a ? p : c && c > t.popupSettings.width ? c : t.popupSettings.width;
3257
- }
3258
- const Cs = (i) => /* @__PURE__ */ o.createElement("div", { className: "k-nodata" }, /* @__PURE__ */ o.createElement("div", null, i.children)), { sizeMap: Ii, roundedMap: xi } = Ge, Ci = "Please select a value from the list!", ki = (i) => /* @__PURE__ */ o.createElement("span", { className: "k-input-value-text" }, i.children), ps = (i) => i.split("_").map((t) => parseInt(t, 10)), Si = (i, t) => {
3259
- const { validationMessage: e, valid: s, required: n } = i;
3260
- return {
3261
- customError: e !== void 0,
3262
- valid: !!(s !== void 0 ? s : !n || t),
3263
- valueMissing: !t
3264
- };
3265
- }, hs = {
3266
- selectField: "selected",
3267
- subItemsField: "items",
3268
- popupSettings: {
3269
- animate: !0,
3270
- width: "200px",
3271
- height: "200px"
3272
- },
3273
- data: [],
3274
- required: !1,
3275
- style: {},
3276
- validityStyles: !0,
3277
- size: "medium",
3278
- rounded: "medium",
3279
- fillMode: "solid"
3280
- }, wi = Be(), ks = o.forwardRef((i, t) => {
3281
- $e(Ye);
3282
- const e = Ut(wi, i), s = {
3283
- ...hs,
3284
- ...e
3285
- }, n = gs(), a = s.id || n, {
3286
- data: p,
3287
- dataItemKey: c,
3288
- popupSettings: d = {},
3289
- style: r,
3290
- opened: h,
3291
- disabled: u,
3292
- onOpen: f = Fe,
3293
- onClose: m = Fe,
3294
- placeholder: v,
3295
- label: b,
3296
- name: w,
3297
- selectField: k,
3298
- subItemsField: D,
3299
- validationMessage: O,
3300
- valid: N,
3301
- required: _,
3302
- validityStyles: S
3303
- } = s, F = Gt(s.tabIndex, u), C = o.useRef(null), E = o.useRef(null), M = o.useRef(null), A = o.useRef(null), j = o.useRef(null), Y = o.useRef(null), Z = o.useRef(!1), [K, be] = o.useState(void 0), X = s.value !== void 0, Q = X ? s.value : K !== void 0 ? K : s.defaultValue, ae = U(Q), Ke = ae ? V(Q, s.textField) : "", Oe = Si({ validationMessage: O, valid: N, required: _ }, ae), Le = o.useCallback(() => E.current && E.current.focus(), []);
3304
- o.useImperativeHandle(
3305
- C,
3306
- () => ({
3307
- props: s,
3308
- element: E.current,
3309
- focus: Le
3310
- })
3311
- ), o.useImperativeHandle(t, () => C.current);
3312
- const H = ms(E, s.dir), P = {
3313
- width: xs(E, hs, d, r),
3314
- ...H !== void 0 ? { direction: H } : {}
3315
- }, [W, ge] = o.useState(!1), z = h !== void 0 ? h : W, [J, ke] = o.useState(!1), [le, q] = o.useState(), re = !!(le && le <= Ee && s.adaptive), [Se, ee] = o.useState(""), ct = o.useCallback(
3316
- () => {
3317
- j.current && j.current.setCustomValidity && j.current.setCustomValidity(
3318
- Oe.valid ? "" : O === void 0 ? Ci : O
3319
- );
3320
- },
3321
- [O, Oe]
3322
- );
3323
- o.useEffect(ct), o.useEffect(() => {
3324
- const I = Me && window.ResizeObserver && new window.ResizeObserver(Vt.bind(void 0));
3325
- return document != null && document.body && I && I.observe(document.body), () => {
3326
- document != null && document.body && I && I.disconnect();
3327
- };
3328
- }, []);
3329
- const pt = o.useCallback(
3330
- (I) => {
3331
- if (!z) {
3332
- if (f) {
3333
- const T = { ...I };
3334
- f.call(void 0, T);
3335
- }
3336
- h === void 0 && ge(!0);
3337
- }
3338
- },
3339
- [z, h, f]
3340
- ), we = o.useCallback(
3341
- (I) => {
3342
- if (z) {
3343
- if (m) {
3344
- const T = { ...I };
3345
- m.call(void 0, T);
3346
- }
3347
- h === void 0 && (ge(!1), re && setTimeout(() => {
3348
- var T;
3349
- $((T = A.current) == null ? void 0 : T.element);
3350
- }, 300));
3351
- }
3352
- },
3353
- [z, h, m, re]
3354
- ), Ot = o.useCallback(
3355
- (I) => {
3356
- if (!I.isDefaultPrevented() && C.current) {
3357
- ke(!0);
3358
- const T = {
3359
- syntheticEvent: I,
3360
- nativeEvent: I.nativeEvent,
3361
- target: C.current
3362
- };
3363
- (z ? we : pt)(T);
3364
- }
3365
- },
3366
- [z, h, f, m]
3367
- ), ne = o.useCallback(
3368
- (I) => {
3369
- Z.current = !0, I(), window.setTimeout(() => Z.current = !1, 0);
3370
- },
3371
- []
3372
- ), He = o.useCallback(
3373
- (I) => {
3374
- var x, L;
3375
- const { keyCode: T, altKey: G } = I, pe = Y.current && Y.current.element;
3376
- if (!C.current || I.isDefaultPrevented() && ((x = M.current) == null ? void 0 : x.element) === I.target)
3377
- return;
3378
- const y = {
3379
- syntheticEvent: I,
3380
- nativeEvent: I.nativeEvent,
3381
- target: C.current
3382
- };
3383
- if (z)
3384
- if (T === g.esc || G && T === g.up)
3385
- I.preventDefault(), we(y);
3386
- else if (pe && pe.querySelector(".k-focus") && (T === g.up || T === g.down || T === g.left || T === g.right || T === g.home || T === g.end)) {
3387
- if (T === g.up && ((L = M.current) != null && L.element)) {
3388
- const se = Array.from(pe.querySelectorAll(".k-treeview-item")), Ie = [...se].reverse().find((xe) => !!(xe && xe.querySelector(".k-focus")));
3389
- if (Ie && se.indexOf(Ie) === 0)
3390
- return ne(() => {
3391
- var xe;
3392
- $((xe = M.current) == null ? void 0 : xe.element);
3393
- });
3394
- }
3395
- ne(Fe);
3396
- } else
3397
- T === g.down && ne(() => {
3398
- var se;
3399
- $(((se = M.current) == null ? void 0 : se.element) || pe);
3400
- });
3401
- else
3402
- G && T === g.down ? (I.preventDefault(), pt(y)) : z || T === g.esc && ft(I);
3403
- },
3404
- [z, h, f, m]
3405
- ), Pe = o.useCallback(
3406
- (I) => {
3407
- const { keyCode: T, altKey: G } = I;
3408
- G || T !== g.up && T !== g.down || (I.preventDefault(), ne(
3409
- T === g.up ? () => {
3410
- $(E.current);
3411
- } : () => {
3412
- $(Y.current && Y.current.element);
3413
- }
3414
- ));
3415
- },
3416
- []
3417
- ), $ = o.useCallback(
3418
- (I) => {
3419
- I && ne(() => I.focus());
3420
- },
3421
- []
3422
- ), fe = o.useCallback(
3423
- () => {
3424
- var I;
3425
- !J && z && !h ? we({ target: C.current }) : e.filterable ? $((I = M.current) == null ? void 0 : I.element) : $(Y.current && Y.current.element);
3426
- },
3427
- [m, e.filterable, J, h, z]
3428
- ), te = o.useCallback(
3429
- () => {
3430
- J && $(E.current);
3431
- },
3432
- [J]
3433
- ), Pt = o.useCallback(
3434
- (I) => {
3435
- if (!J && !Z.current && (ke(!0), e.onFocus && C.current)) {
3436
- const T = {
3437
- syntheticEvent: I,
3438
- nativeEvent: I.nativeEvent,
3439
- target: C.current
3440
- };
3441
- e.onFocus.call(void 0, T);
3442
- }
3443
- },
3444
- [J, e.onFocus]
3445
- ), _t = o.useCallback(
3446
- (I) => {
3447
- if (J && !Z.current && C.current) {
3448
- ke(!1);
3449
- const T = {
3450
- syntheticEvent: I,
3451
- nativeEvent: I.nativeEvent,
3452
- target: C.current
3453
- };
3454
- if (e.onBlur) {
3455
- const G = { ...T };
3456
- e.onBlur.call(void 0, G);
3457
- }
3458
- re || we(T);
3459
- }
3460
- },
3461
- [J, e.onBlur, z, h, m]
3462
- ), Rt = o.useCallback(
3463
- () => {
3464
- J && ne(Fe), re && setTimeout(() => {
3465
- var I;
3466
- $((I = A.current) == null ? void 0 : I.element);
3467
- }, 300);
3468
- },
3469
- [J, re]
3470
- ), ht = o.useCallback(
3471
- (I, T, G) => {
3472
- if (e.onChange) {
3473
- const pe = {
3474
- value: T,
3475
- level: G ? ps(G) : [],
3476
- ...I
3477
- };
3478
- e.onChange.call(void 0, pe);
3479
- }
3480
- X || be(T);
3481
- },
3482
- [e.onChange, X]
3483
- ), ut = o.useCallback(
3484
- (I) => {
3485
- if (R(I.item, Q, c) || !C.current)
3486
- return;
3487
- const { item: T, itemHierarchicalIndex: G, nativeEvent: pe, syntheticEvent: y } = I, x = {
3488
- syntheticEvent: y,
3489
- nativeEvent: pe,
3490
- target: C.current
3491
- };
3492
- ht(x, T, G), we(x);
3493
- },
3494
- [X, Q, e.onChange, c, z, h, m]
3495
- ), ft = o.useCallback(
3496
- (I) => {
3497
- if (!C.current)
3498
- return;
3499
- const T = {
3500
- syntheticEvent: I,
3501
- nativeEvent: I.nativeEvent,
3502
- target: C.current
3503
- };
3504
- ht(T, null), we(T), I.preventDefault();
3505
- },
3506
- [X, e.onChange, z, h, m]
3507
- ), gt = o.useCallback(
3508
- (I) => {
3509
- if (I.syntheticEvent.stopPropagation(), e.onExpandChange && C.current) {
3510
- const { item: T, itemHierarchicalIndex: G, nativeEvent: pe, syntheticEvent: y } = I, x = {
3511
- level: ps(G),
3512
- item: T,
3513
- nativeEvent: pe,
3514
- syntheticEvent: y,
3515
- target: C.current
3516
- };
3517
- e.onExpandChange.call(void 0, x);
3518
- }
3519
- },
3520
- [e.onExpandChange]
3521
- ), Je = o.useCallback(
3522
- (I) => {
3523
- if (e.onFilterChange && C.current) {
3524
- const G = {
3525
- filter: { field: e.textField, operator: "contains", value: I.target.value },
3526
- syntheticEvent: I.syntheticEvent,
3527
- nativeEvent: I.nativeEvent,
3528
- target: C.current
3529
- };
3530
- e.onFilterChange.call(void 0, G), e.filter === void 0 && ee(I.target.value);
3531
- }
3532
- },
3533
- [e.onFilterChange, e.filter, e.textField]
3534
- ), Qe = () => {
3535
- const I = s.filterable ? /* @__PURE__ */ o.createElement(
3536
- Re,
3537
- {
3538
- value: s.filter === void 0 ? Se : s.filter,
3539
- ref: A,
3540
- onChange: Je,
3541
- onKeyDown: Pe,
3542
- size: me,
3543
- rounded: ye,
3544
- fillMode: De
3545
- }
3546
- ) : null, T = {
3547
- adaptiveTitle: s.adaptiveTitle,
3548
- expand: z,
3549
- onClose: (G) => we(G),
3550
- windowWidth: le,
3551
- mobileFilter: I
3552
- };
3553
- return /* @__PURE__ */ o.createElement(ts, { ...T }, /* @__PURE__ */ o.createElement(lt, { className: "!k-overflow-hidden" }, /* @__PURE__ */ o.createElement("div", { className: "k-list-container" }, /* @__PURE__ */ o.createElement("div", { className: "k-list k-list-lg" }, p.length > 0 ? /* @__PURE__ */ o.createElement(
3554
- kt,
3555
- {
3556
- ref: Y,
3557
- tabIndex: F,
3558
- data: Xe,
3559
- focusIdField: c,
3560
- textField: s.textField,
3561
- selectField: k,
3562
- expandField: s.expandField,
3563
- childrenField: D,
3564
- expandIcons: !0,
3565
- onItemClick: ut,
3566
- onExpandChange: gt,
3567
- size: me,
3568
- item: s.item,
3569
- dir: H
3570
- }
3571
- ) : /* @__PURE__ */ o.createElement(Ze, null, et.toLanguageString(ve, ce[ve]))))));
3572
- }, Vt = o.useCallback(
3573
- (I) => {
3574
- for (let T of I)
3575
- q(T.target.clientWidth);
3576
- },
3577
- []
3578
- ), Xe = o.useMemo(
3579
- () => X || !ae ? p : Ts(
3580
- p,
3581
- D,
3582
- (I) => Ms(
3583
- I,
3584
- D,
3585
- { [k]: R(I, Q, c) }
3586
- )
3587
- ),
3588
- [p, Q, X, ae, k, D]
3589
- ), Ze = s.listNoData || Cs, mt = s.valueHolder || ki, et = bs(), vt = !S || Oe.valid, { size: me, rounded: ye, fillMode: De } = s, de = /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(
3590
- "span",
3591
- {
3592
- className: B("k-dropdowntree k-picker", s.className, {
3593
- [`k-picker-${Ii[me] || me}`]: me,
3594
- [`k-rounded-${xi[ye] || ye}`]: ye,
3595
- [`k-picker-${De}`]: De,
3596
- "k-focus": J,
3597
- "k-invalid": !vt,
3598
- "k-loading": s.loading,
3599
- "k-required": _,
3600
- "k-disabled": s.disabled
3601
- }),
3602
- tabIndex: F,
3603
- accessKey: s.accessKey,
3604
- id: a,
3605
- style: b ? { ...r, width: void 0 } : r,
3606
- dir: H,
3607
- ref: E,
3608
- onKeyDown: u ? void 0 : He,
3609
- onMouseDown: Rt,
3610
- onClick: u ? void 0 : Ot,
3611
- onFocus: Pt,
3612
- onBlur: _t,
3613
- role: "combobox",
3614
- "aria-haspopup": "tree",
3615
- "aria-expanded": z,
3616
- "aria-disabled": u,
3617
- "aria-label": b,
3618
- "aria-labelledby": s.ariaLabelledBy,
3619
- "aria-describedby": s.ariaDescribedBy,
3620
- "aria-required": _
3621
- },
3622
- /* @__PURE__ */ o.createElement("span", { className: "k-input-inner" }, /* @__PURE__ */ o.createElement(mt, { item: Q }, Ke || v)),
3623
- s.loading && /* @__PURE__ */ o.createElement(Ce, { className: "k-input-loading-icon", name: "loading" }),
3624
- ae && !u && /* @__PURE__ */ o.createElement(
3625
- "span",
3626
- {
3627
- onClick: ft,
3628
- className: "k-clear-value",
3629
- title: et.toLanguageString(it, ce[it]),
3630
- role: "button",
3631
- tabIndex: -1,
3632
- onMouseDown: (I) => I.preventDefault()
3633
- },
3634
- /* @__PURE__ */ o.createElement(Ce, { name: "x", icon: at })
3635
- ),
3636
- /* @__PURE__ */ o.createElement(
3637
- Te,
3638
- {
3639
- tabIndex: -1,
3640
- type: "button",
3641
- "aria-label": "select",
3642
- className: "k-input-button",
3643
- size: me,
3644
- fillMode: De,
3645
- themeColor: "base",
3646
- rounded: null,
3647
- icon: "caret-alt-down",
3648
- svgIcon: jt
3649
- }
3650
- ),
3651
- /* @__PURE__ */ o.createElement(
3652
- "select",
3653
- {
3654
- name: w,
3655
- ref: j,
3656
- tabIndex: -1,
3657
- "aria-hidden": !0,
3658
- title: b,
3659
- style: { opacity: 0, width: 1, border: 0, zIndex: -1, position: "absolute", left: "50%" }
3660
- },
3661
- /* @__PURE__ */ o.createElement("option", { value: s.valueMap ? s.valueMap.call(void 0, Q) : Q })
3662
- ),
3663
- !re && /* @__PURE__ */ o.createElement(
3664
- Yt,
3665
- {
3666
- ...d,
3667
- className: B(d.className, { "k-rtl": H === "rtl" }),
3668
- popupClass: B(d.popupClass, "k-dropdowntree-popup"),
3669
- style: P,
3670
- anchor: d.anchor || E.current,
3671
- show: z,
3672
- onOpen: fe,
3673
- onClose: te
3674
- },
3675
- s.filterable && /* @__PURE__ */ o.createElement(
3676
- Re,
3677
- {
3678
- value: s.filter === void 0 ? Se : s.filter,
3679
- ref: M,
3680
- onChange: Je,
3681
- onKeyDown: Pe,
3682
- size: me,
3683
- rounded: ye,
3684
- fillMode: De
3685
- }
3686
- ),
3687
- p.length > 0 ? /* @__PURE__ */ o.createElement(
3688
- kt,
3689
- {
3690
- style: { height: d.height },
3691
- ref: Y,
3692
- tabIndex: F,
3693
- data: Xe,
3694
- focusIdField: c,
3695
- textField: s.textField,
3696
- selectField: k,
3697
- expandField: s.expandField,
3698
- childrenField: D,
3699
- expandIcons: !0,
3700
- onItemClick: ut,
3701
- onExpandChange: gt,
3702
- size: me,
3703
- item: s.item,
3704
- dir: H
3705
- }
3706
- ) : /* @__PURE__ */ o.createElement(Ze, null, et.toLanguageString(ve, ce[ve]))
3707
- )
3708
- ), re && Qe());
3709
- return b ? /* @__PURE__ */ o.createElement(
3710
- Ue,
3711
- {
3712
- label: b,
3713
- editorValue: Ke,
3714
- editorPlaceholder: v,
3715
- editorValid: vt,
3716
- editorDisabled: u,
3717
- editorId: a,
3718
- style: { width: r ? r.width : void 0 },
3719
- children: de,
3720
- dir: H
3721
- }
3722
- ) : de;
3723
- }), Ei = {
3724
- opened: l.bool,
3725
- disabled: l.bool,
3726
- dir: l.string,
3727
- tabIndex: l.number,
3728
- accessKey: l.string,
3729
- data: l.array,
3730
- value: l.any,
3731
- valueMap: l.func,
3732
- placeholder: l.string,
3733
- dataItemKey: l.string.isRequired,
3734
- textField: l.string.isRequired,
3735
- selectField: l.string,
3736
- expandField: l.string,
3737
- subItemsField: l.string,
3738
- className: l.string,
3739
- style: l.object,
3740
- label: l.string,
3741
- validationMessage: l.string,
3742
- validityStyles: l.bool,
3743
- valid: l.bool,
3744
- required: l.bool,
3745
- name: l.string,
3746
- id: l.string,
3747
- ariaLabelledBy: l.string,
3748
- ariaDescribedBy: l.string,
3749
- filterable: l.bool,
3750
- filter: l.string,
3751
- loading: l.bool,
3752
- popupSettings: l.shape({
3753
- animate: l.oneOfType([l.bool, l.shape({
3754
- openDuration: l.number,
3755
- closeDuration: l.number
3756
- })]),
3757
- popupClass: l.string,
3758
- className: l.string,
3759
- appendTo: l.any,
3760
- width: l.oneOfType([l.string, l.number]),
3761
- height: l.oneOfType([l.string, l.number])
3762
- }),
3763
- onOpen: l.func,
3764
- onClose: l.func,
3765
- onFocus: l.func,
3766
- onBlur: l.func,
3767
- onChange: l.func,
3768
- onFilterChange: l.func,
3769
- onExpandChange: l.func,
3770
- item: l.func,
3771
- valueHolder: l.func,
3772
- listNoData: l.func,
3773
- adaptiveTitle: l.string,
3774
- adaptive: l.bool
3775
- };
3776
- ks.displayName = "KendoReactDropDownTree";
3777
- ks.propTypes = Ei;
3778
- const Di = "Please select a value from the list!", { sizeMap: us, roundedMap: Fi } = Ge, Ti = (i) => i.split("_").map((t) => parseInt(t, 10)), Mi = (i, t) => {
3779
- const { validationMessage: e, valid: s, required: n } = i;
3780
- return {
3781
- customError: e !== void 0,
3782
- valid: !!(s !== void 0 ? s : !n || t),
3783
- valueMissing: !t
3784
- };
3785
- }, _e = {
3786
- checkField: "checkField",
3787
- checkIndeterminateField: "checkIndeterminateField",
3788
- subItemsField: "items",
3789
- popupSettings: {
3790
- animate: !0,
3791
- width: "200px",
3792
- height: "200px"
3793
- },
3794
- size: "medium",
3795
- rounded: "medium",
3796
- fillMode: "solid",
3797
- required: !1,
3798
- validityStyles: !0
3799
- }, Ni = Be(), is = o.forwardRef((i, t) => {
3800
- const e = Ut(Ni, i);
3801
- $e(Ye);
3802
- const s = gs(), n = e.id || s, {
3803
- data: a = [],
3804
- dataItemKey: p,
3805
- popupSettings: c = {},
3806
- style: d = {},
3807
- opened: r,
3808
- disabled: h,
3809
- onOpen: u = Fe,
3810
- onClose: f = Fe,
3811
- placeholder: m,
3812
- label: v,
3813
- name: b,
3814
- checkField: w = _e.checkField,
3815
- checkIndeterminateField: k = _e.checkIndeterminateField,
3816
- subItemsField: D = _e.subItemsField,
3817
- validationMessage: O,
3818
- valid: N,
3819
- tags: _,
3820
- value: S,
3821
- required: F = _e.required,
3822
- validityStyles: C = _e.validityStyles
3823
- } = e, E = Gt(e.tabIndex, h), M = o.useRef(null), A = o.useRef(null), j = o.useRef(null), Y = o.useRef(null), Z = o.useRef(null), K = o.useRef(null), be = o.useRef(!1), X = o.useRef([]), Q = o.useRef(null), [ae, Ke] = o.useState(), [Oe, Le] = o.useState(!1), [H, ze] = o.useState(!1), [P, W] = o.useState(), [ge, z] = o.useState([]), [J, ke] = o.useState(""), le = !!(P && P <= Ee && e.adaptive), q = r !== void 0 ? r : Oe, re = !!(Array.isArray(S) && S.length), Se = Mi({ validationMessage: O, valid: N, required: F }, re), ee = ms(A, e.dir), pt = {
3824
- width: xs(A, _e, c, d),
3825
- ...ee !== void 0 ? { direction: ee } : {}
3826
- }, we = o.useCallback(() => A.current && A.current.focus(), []);
3827
- X.current = _ === void 0 ? (S || []).map((y) => ({ text: V(y, e.textField), data: [y] })) : [..._], o.useImperativeHandle(
3828
- M,
3829
- () => ({
3830
- props: e,
3831
- element: A.current,
3832
- focus: we
3833
- })
3834
- ), o.useImperativeHandle(t, () => M.current);
3835
- const Ot = o.useCallback(
3836
- () => {
3837
- Z.current && Z.current.setCustomValidity && Z.current.setCustomValidity(
3838
- Se.valid ? "" : O === void 0 ? Di : O
3839
- );
3840
- },
3841
- [O, Se]
3842
- );
3843
- o.useEffect(Ot), o.useEffect(() => {
3844
- const y = Me && window.ResizeObserver && new window.ResizeObserver(vt.bind(void 0));
3845
- return document != null && document.body && y && y.observe(document.body), () => {
3846
- y && y.disconnect();
3847
- };
3848
- }, []), o.useEffect(
3849
- () => {
3850
- Q.current && q && Q.current.setPosition(Q.current._popup);
3851
- },
3852
- [S, q]
3853
- );
3854
- const ne = o.useCallback(
3855
- (y, x, L) => {
3856
- if (e.onChange) {
3857
- const se = {
3858
- items: x,
3859
- operation: L,
3860
- ...y
3861
- };
3862
- e.onChange.call(void 0, se);
3863
- }
3864
- },
3865
- [e.onChange]
3866
- ), He = o.useCallback(
3867
- (y) => {
3868
- if (R(y.item, S, p) || !M.current)
3869
- return;
3870
- const { item: x, nativeEvent: L, syntheticEvent: se } = y, Ie = {
3871
- syntheticEvent: se,
3872
- nativeEvent: L,
3873
- target: M.current
3874
- };
3875
- ne(Ie, [x], "toggle");
3876
- },
3877
- [S, p, ne]
3878
- ), Pe = o.useCallback(
3879
- (y) => {
3880
- if (!q) {
3881
- if (u) {
3882
- const x = { ...y };
3883
- u.call(void 0, x);
3884
- }
3885
- r === void 0 && (Le(!0), z(S || []), le && setTimeout(() => {
3886
- var x;
3887
- te((x = Y.current) == null ? void 0 : x.element);
3888
- }, 300));
3889
- }
3890
- },
3891
- [q, r, u, le, Y]
3892
- ), $ = o.useCallback(
3893
- (y) => {
3894
- if (q) {
3895
- if (f) {
3896
- const x = { ...y };
3897
- f.call(void 0, x);
3898
- }
3899
- r === void 0 && Le(!1);
3900
- }
3901
- },
3902
- [q, r, f]
3903
- ), fe = o.useCallback(
3904
- (y) => {
3905
- be.current = !0, y(), window.setTimeout(() => be.current = !1, 0);
3906
- },
3907
- []
3908
- ), te = o.useCallback(
3909
- (y) => {
3910
- y && fe(() => y.focus());
3911
- },
3912
- [fe]
3913
- ), Pt = o.useCallback(
3914
- () => {
3915
- var y;
3916
- !H && q ? $({ target: M.current }) : e.filterable ? te((y = j.current) == null ? void 0 : y.element) : te(K.current && K.current.element);
3917
- },
3918
- [H, q, te, $, e.filterable]
3919
- ), _t = o.useCallback(
3920
- () => {
3921
- H && te(A.current);
3922
- },
3923
- [H, te]
3924
- ), Rt = o.useCallback(
3925
- (y) => {
3926
- if (!H && !be.current && (ze(!0), e.onFocus && M.current)) {
3927
- const x = {
3928
- syntheticEvent: y,
3929
- nativeEvent: y.nativeEvent,
3930
- target: M.current
3931
- };
3932
- e.onFocus.call(void 0, x);
3933
- }
3934
- },
3935
- [H, e.onFocus]
3936
- ), ht = o.useCallback(
3937
- (y) => {
3938
- if (H && !be.current && M.current) {
3939
- ze(!1);
3940
- const x = {
3941
- syntheticEvent: y,
3942
- nativeEvent: y.nativeEvent,
3943
- target: M.current
3944
- };
3945
- if (e.onBlur) {
3946
- const L = { ...x };
3947
- e.onBlur.call(void 0, L);
3948
- }
3949
- le || $(x);
3950
- }
3951
- },
3952
- [H, e.onBlur, q, r, f]
3953
- ), ut = o.useCallback(
3954
- () => {
3955
- H && fe(Fe);
3956
- },
3957
- [H, fe]
3958
- ), ft = o.useCallback(
3959
- (y) => {
3960
- if (!y.isDefaultPrevented() && M.current) {
3961
- ze(!0);
3962
- const x = {
3963
- syntheticEvent: y,
3964
- nativeEvent: y.nativeEvent,
3965
- target: M.current
3966
- };
3967
- q || Pe(x);
3968
- }
3969
- },
3970
- [q, Pe]
3971
- ), gt = o.useCallback(
3972
- (y) => {
3973
- var xe, ns;
3974
- const { keyCode: x, altKey: L } = y, se = K.current && K.current.element;
3975
- if (!M.current || y.isDefaultPrevented() && ((xe = j.current) == null ? void 0 : xe.element) === y.target)
3976
- return;
3977
- const Ie = {
3978
- syntheticEvent: y,
3979
- nativeEvent: y.nativeEvent,
3980
- target: M.current
3981
- };
3982
- if (S && S.length > 0 && (x === g.left || x === g.right || x === g.home || x === g.end || x === g.delete)) {
3983
- const ie = X.current;
3984
- let he = ae ? ie.findIndex((Ss) => St(Ss, ae, p)) : -1, ue;
3985
- const Bt = he !== -1;
3986
- x === g.left ? (Bt ? he = Math.max(0, he - 1) : he = ie.length - 1, ue = ie[he]) : x === g.right ? he === ie.length - 1 ? ue = void 0 : Bt && (he = Math.min(ie.length - 1, he + 1), ue = ie[he]) : x === g.home ? ue = ie[0] : x === g.end ? ue = ie[ie.length - 1] : x === g.delete && Bt && ne(Ie, ie[he].data, "delete"), ue !== ae && Ke(ue);
3987
- }
3988
- if (q)
3989
- if (x === g.esc || L && x === g.up)
3990
- y.preventDefault(), $(Ie);
3991
- else if (se && se.querySelector(".k-focus") && (x === g.up || x === g.down || x === g.left || x === g.right || x === g.home || x === g.end)) {
3992
- if (x === g.up && ((ns = j.current) != null && ns.element)) {
3993
- const ie = Array.from(se.querySelectorAll(".k-treeview-item")), he = [...ie].reverse().find((ue) => !!(ue && ue.querySelector(".k-focus")));
3994
- if (he && ie.indexOf(he) === 0)
3995
- return fe(() => {
3996
- var ue;
3997
- te((ue = j.current) == null ? void 0 : ue.element);
3998
- });
3999
- }
4000
- fe(Fe);
4001
- } else
4002
- x === g.down && fe(() => {
4003
- var ie;
4004
- te(((ie = j.current) == null ? void 0 : ie.element) || se);
4005
- });
4006
- else
4007
- L && x === g.down && (y.preventDefault(), Pe(Ie));
4008
- },
4009
- [q, $, te, fe, Pe, ae, p, S, ne]
4010
- ), Je = o.useCallback(
4011
- (y) => {
4012
- const { keyCode: x, altKey: L } = y;
4013
- L || x !== g.up && x !== g.down || (y.preventDefault(), fe(
4014
- x === g.up ? () => {
4015
- te(A.current);
4016
- } : () => {
4017
- te(K.current && K.current.element);
4018
- }
4019
- ));
4020
- },
4021
- [te, fe]
4022
- ), Qe = o.useCallback(
4023
- (y) => {
4024
- if (!M.current)
4025
- return;
4026
- const x = {
4027
- syntheticEvent: y,
4028
- nativeEvent: y.nativeEvent,
4029
- target: M.current
4030
- };
4031
- ne(x, [], "clear"), $(x), y.preventDefault();
4032
- },
4033
- [ne, $]
4034
- ), Vt = o.useCallback(
4035
- (y, x) => {
4036
- var L;
4037
- $({ target: M.current }), H || te((L = j.current) == null ? void 0 : L.element), ne({
4038
- syntheticEvent: x,
4039
- nativeEvent: x.nativeEvent,
4040
- target: M.current
4041
- }, y, "delete");
4042
- },
4043
- [ne, $, te, H]
4044
- ), Xe = o.useCallback(
4045
- (y) => {
4046
- if (e.onExpandChange && M.current) {
4047
- const { item: x, itemHierarchicalIndex: L, nativeEvent: se, syntheticEvent: Ie } = y, xe = {
4048
- level: Ti(L),
4049
- item: x,
4050
- nativeEvent: se,
4051
- syntheticEvent: Ie,
4052
- target: M.current
4053
- };
4054
- e.onExpandChange.call(void 0, xe);
4055
- }
4056
- },
4057
- [e.onExpandChange]
4058
- ), Ze = o.useCallback(
4059
- (y) => {
4060
- if (e.onFilterChange && M.current) {
4061
- const L = {
4062
- filter: { field: e.textField, operator: "contains", value: y.target.value },
4063
- syntheticEvent: y.syntheticEvent,
4064
- nativeEvent: y.nativeEvent,
4065
- target: M.current
4066
- };
4067
- e.onFilterChange.call(void 0, L), e.filter === void 0 && ke(y.target.value);
4068
- }
4069
- },
4070
- [e.onFilterChange, e.filter, e.textField]
4071
- ), mt = o.useCallback(
4072
- (y) => {
4073
- if (!M.current)
4074
- return;
4075
- const x = {
4076
- syntheticEvent: y,
4077
- nativeEvent: y.nativeEvent,
4078
- target: M.current
4079
- };
4080
- e.onCancel && e.onCancel.call(void 0, x), $(x), y.preventDefault();
4081
- },
4082
- [e.onCancel, $]
4083
- ), et = () => {
4084
- const y = e.filterable ? /* @__PURE__ */ o.createElement(
4085
- Re,
4086
- {
4087
- value: e.filter === void 0 ? J : e.filter,
4088
- ref: Y,
4089
- onChange: Ze,
4090
- onKeyDown: Je,
4091
- size: de,
4092
- rounded: I,
4093
- fillMode: T
4094
- }
4095
- ) : null, x = {
4096
- adaptiveTitle: e.adaptiveTitle,
4097
- expand: q,
4098
- onClose: (L) => e.onCancel ? mt(L) : Qe(L),
4099
- windowWidth: P,
4100
- mobileFilter: y,
4101
- footer: {
4102
- cancelText: ye.toLanguageString(ot, ce[ot]),
4103
- onCancel: (L) => e.onCancel ? mt(L) : Qe(L),
4104
- applyText: ye.toLanguageString(nt, ce[nt]),
4105
- onApply: (L) => $(L)
4106
- }
4107
- };
4108
- return /* @__PURE__ */ o.createElement(ts, { ...x }, /* @__PURE__ */ o.createElement(lt, { className: "!k-overflow-hidden" }, /* @__PURE__ */ o.createElement("div", { className: "k-list-container" }, /* @__PURE__ */ o.createElement("div", { className: "k-list k-list-lg" }, a.length > 0 ? /* @__PURE__ */ o.createElement(
4109
- kt,
4110
- {
4111
- ref: K,
4112
- tabIndex: E,
4113
- data: a,
4114
- focusIdField: p,
4115
- textField: e.textField,
4116
- checkField: w,
4117
- checkIndeterminateField: k,
4118
- expandField: e.expandField,
4119
- childrenField: D,
4120
- expandIcons: !0,
4121
- onItemClick: He,
4122
- onCheckChange: He,
4123
- onExpandChange: Xe,
4124
- checkboxes: !0,
4125
- size: de,
4126
- item: e.item,
4127
- dir: ee
4128
- }
4129
- ) : /* @__PURE__ */ o.createElement(me, null, ye.toLanguageString(ve, ce[ve]))))));
4130
- }, vt = o.useCallback(
4131
- (y) => {
4132
- for (let x of y)
4133
- W(x.target.clientWidth);
4134
- },
4135
- []
4136
- ), me = e.listNoData || Cs, ye = bs(), De = !C || Se.valid, { size: de, rounded: I, fillMode: T } = e, G = le && q ? ge : X.current, pe = /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(
4137
- "span",
4138
- {
4139
- className: B("k-multiselecttree k-input", e.className, {
4140
- [`k-input-${us[de] || de}`]: de,
4141
- [`k-rounded-${Fi[I] || I}`]: I,
4142
- [`k-input-${T}`]: T,
4143
- "k-focus": H && !h,
4144
- "k-invalid": !De,
4145
- "k-disabled": h,
4146
- "k-loading": e.loading,
4147
- "k-required": F
4148
- }),
4149
- tabIndex: E,
4150
- accessKey: e.accessKey,
4151
- id: n,
4152
- style: v ? { ...d, width: void 0 } : d,
4153
- dir: ee,
4154
- ref: A,
4155
- onKeyDown: h ? void 0 : gt,
4156
- onMouseDown: ut,
4157
- onFocus: Rt,
4158
- onBlur: ht,
4159
- role: "combobox",
4160
- "aria-haspopup": "tree",
4161
- "aria-expanded": q,
4162
- "aria-disabled": h,
4163
- "aria-label": v,
4164
- "aria-labelledby": e.ariaLabelledBy,
4165
- "aria-describedby": e.ariaDescribedBy ? e.ariaDescribedBy : "tagslist-" + n,
4166
- "aria-required": e.required,
4167
- onClick: h ? void 0 : ft
4168
- },
4169
- /* @__PURE__ */ o.createElement(
4170
- "div",
4171
- {
4172
- id: "tagslist-" + n,
4173
- className: B("k-input-values k-chip-list k-selection-multiple", {
4174
- [`k-chip-list-${us[de] || de}`]: de
4175
- })
4176
- },
4177
- G.length > 0 && /* @__PURE__ */ o.createElement(
4178
- Is,
4179
- {
4180
- tag: e.tag,
4181
- onTagDelete: Vt,
4182
- data: G,
4183
- guid: n,
4184
- focused: ae ? X.current.find((y) => St(y, ae, p)) : void 0,
4185
- size: de
4186
- }
4187
- )
4188
- ),
4189
- /* @__PURE__ */ o.createElement("span", { className: "k-input-inner" }, G.length === 0 && /* @__PURE__ */ o.createElement("span", { className: "k-input-value-text" }, m)),
4190
- e.loading && /* @__PURE__ */ o.createElement(Ce, { className: "k-input-loading-icon", name: "loading" }),
4191
- re && !h && G.length > 0 && /* @__PURE__ */ o.createElement(rt, { onClick: Qe }),
4192
- /* @__PURE__ */ o.createElement(
4193
- "select",
4194
- {
4195
- name: b,
4196
- ref: Z,
4197
- tabIndex: -1,
4198
- "aria-hidden": !0,
4199
- title: v,
4200
- style: { opacity: 0, width: 1, border: 0, zIndex: -1, position: "absolute", left: "50%" }
4201
- },
4202
- /* @__PURE__ */ o.createElement(
4203
- "option",
4204
- {
4205
- value: e.valueMap ? e.valueMap.call(void 0, S) : S
4206
- }
4207
- )
4208
- ),
4209
- !le && /* @__PURE__ */ o.createElement(
4210
- Yt,
4211
- {
4212
- ...c,
4213
- popupClass: B(
4214
- c.popupClass,
4215
- "k-multiselecttree-popup"
4216
- ),
4217
- className: B(c.className, { "k-rtl": ee === "rtl" }),
4218
- style: pt,
4219
- anchor: c.anchor || A.current,
4220
- show: q,
4221
- onOpen: Pt,
4222
- onClose: _t,
4223
- ref: Q
4224
- },
4225
- e.filterable && /* @__PURE__ */ o.createElement(
4226
- Re,
4227
- {
4228
- value: e.filter === void 0 ? J : e.filter,
4229
- ref: j,
4230
- onChange: Ze,
4231
- onKeyDown: Je,
4232
- tabIndex: E,
4233
- size: de,
4234
- rounded: I,
4235
- fillMode: T
4236
- }
4237
- ),
4238
- a.length > 0 ? /* @__PURE__ */ o.createElement(
4239
- kt,
4240
- {
4241
- style: { height: c.height },
4242
- ref: K,
4243
- tabIndex: E,
4244
- data: a,
4245
- focusIdField: p,
4246
- textField: e.textField,
4247
- checkField: w,
4248
- checkIndeterminateField: k,
4249
- expandField: e.expandField,
4250
- childrenField: D,
4251
- expandIcons: !0,
4252
- onItemClick: He,
4253
- onCheckChange: He,
4254
- onExpandChange: Xe,
4255
- checkboxes: !0,
4256
- size: de,
4257
- item: e.item,
4258
- dir: ee
4259
- }
4260
- ) : /* @__PURE__ */ o.createElement(me, null, ye.toLanguageString(ve, ce[ve]))
4261
- )
4262
- ), le && et());
4263
- return v ? /* @__PURE__ */ o.createElement(
4264
- Ue,
4265
- {
4266
- label: v,
4267
- editorValue: re,
4268
- editorPlaceholder: m,
4269
- editorValid: De,
4270
- editorDisabled: h,
4271
- editorId: n,
4272
- style: { width: d ? d.width : void 0 },
4273
- children: pe,
4274
- dir: ee
4275
- }
4276
- ) : pe;
4277
- }), Oi = {
4278
- opened: l.bool,
4279
- disabled: l.bool,
4280
- dir: l.string,
4281
- tabIndex: l.number,
4282
- accessKey: l.string,
4283
- data: l.array,
4284
- value: l.any,
4285
- valueMap: l.func,
4286
- placeholder: l.string,
4287
- dataItemKey: l.string.isRequired,
4288
- textField: l.string.isRequired,
4289
- checkField: l.string,
4290
- checkIndeterminateField: l.string,
4291
- expandField: l.string,
4292
- subItemsField: l.string,
4293
- className: l.string,
4294
- style: l.object,
4295
- label: l.string,
4296
- validationMessage: l.string,
4297
- validityStyles: l.bool,
4298
- valid: l.bool,
4299
- required: l.bool,
4300
- name: l.string,
4301
- id: l.string,
4302
- ariaLabelledBy: l.string,
4303
- ariaDescribedBy: l.string,
4304
- filterable: l.bool,
4305
- filter: l.string,
4306
- loading: l.bool,
4307
- tags: l.arrayOf(l.shape({
4308
- text: l.string,
4309
- data: l.arrayOf(l.any)
4310
- })),
4311
- popupSettings: l.shape({
4312
- animate: l.oneOfType([l.bool, l.shape({
4313
- openDuration: l.number,
4314
- closeDuration: l.number
4315
- })]),
4316
- popupClass: l.string,
4317
- className: l.string,
4318
- appendTo: l.any,
4319
- width: l.oneOfType([l.string, l.number]),
4320
- height: l.oneOfType([l.string, l.number])
4321
- }),
4322
- onOpen: l.func,
4323
- onClose: l.func,
4324
- onFocus: l.func,
4325
- onBlur: l.func,
4326
- onChange: l.func,
4327
- onFilterChange: l.func,
4328
- onExpandChange: l.func,
4329
- onCancel: l.func,
4330
- item: l.func,
4331
- listNoData: l.func,
4332
- adaptiveTitle: l.string,
4333
- adaptive: l.bool
4334
- };
4335
- is.displayName = "KendoReactMultiSelectTree";
4336
- is.defaultProps = _e;
4337
- is.propTypes = Oi;
4338
- const tt = (i, t) => {
4339
- const e = {};
4340
- return i && i.length && i.forEach((s) => {
4341
- e[t(s)] = !0;
4342
- }), e;
4343
- }, qi = (i, t) => {
4344
- const {
4345
- items: e,
4346
- dataItemKey: s,
4347
- value: n,
4348
- subItemsField: a = "items",
4349
- operation: p
4350
- } = t, c = Ct(s), d = tt(n, c);
4351
- if (p === "clear")
4352
- return [];
4353
- if (p === "delete") {
4354
- const N = tt(e, c);
4355
- return n.filter((_) => !N[c(_)]);
4356
- }
4357
- const r = e[0], h = c(r), u = Ct(a), f = [...i], m = [];
4358
- let v = [], b;
4359
- for (; f.length; ) {
4360
- const N = f.pop();
4361
- if (h === c(N)) {
4362
- v = m.map((_) => _.item), b = N;
4363
- break;
4364
- } else {
4365
- m && m.length && m[m.length - 1].parentPosition === f.length && m.pop();
4366
- const _ = u(N);
4367
- _ && _.length && (m.push({ item: N, parentPosition: f.length }), f.push(..._));
4368
- }
4369
- }
4370
- const w = [...u(b) || []];
4371
- let k = [];
4372
- for (; w.length; ) {
4373
- const N = w.pop();
4374
- k.push(N);
4375
- const _ = u(N);
4376
- _ && _.length && w.push(..._);
4377
- }
4378
- const D = !d[h], O = [];
4379
- if (D) {
4380
- O.push(...n), O.push(b), O.push(...k.filter((S) => !d[c(S)]));
4381
- const N = v.filter((S) => !d[c(S)]), _ = tt(O, c);
4382
- for (let S = N.length - 1; S > -1; S--) {
4383
- const F = N[S], C = u(F);
4384
- if (C.filter((M) => _[c(M)]).length < C.length)
4385
- break;
4386
- O.push(F), _[c(F)] = !0;
4387
- }
4388
- } else {
4389
- const N = c(b), _ = tt(k, c), S = tt(v, c);
4390
- O.push(
4391
- ...n.filter((F) => {
4392
- const C = c(F);
4393
- return !_[C] && N !== C && !S[C];
4394
- })
4395
- );
4396
- }
4397
- return O;
4398
- };
9
+ import { DropDownList as e, DropDownListWithoutContext as r, DropDownListPropsContext as p, DropDownListWithoutContext as s } from "./DropDownList/DropDownList.mjs";
10
+ import { default as x } from "./common/ListItem.mjs";
11
+ import { default as n } from "./common/List.mjs";
12
+ import { default as a } from "./common/SearchBar.mjs";
13
+ import { default as C } from "./common/ListContainer.mjs";
14
+ import { default as D } from "./common/ListFilter.mjs";
15
+ import { messages as L, nodata as M } from "./messages/index.mjs";
16
+ import { findByFieldValue as w, getItemValue as B, scrollToItem as P } from "./common/utils.mjs";
17
+ import { ComboBox as T, ComboBoxPropsContext as g, ComboBoxWithoutContext as h } from "./ComboBox/ComboBox.mjs";
18
+ import { AutoComplete as W, AutoCompletePropsContext as V, AutoCompleteWithoutContext as A } from "./AutoComplete/AutoComplete.mjs";
19
+ import { MultiSelect as F, MultiSelectPropsContext as y, MultiSelectWithoutContext as j } from "./MultiSelect/MultiSelect.mjs";
20
+ import { default as q } from "./MultiSelect/TagList.mjs";
21
+ import { MultiColumnComboBox as z, MultiColumnComboBoxPropsContext as E } from "./MultiColumnComboBox/MultiColumnComboBox.mjs";
22
+ import { DropDownTree as H, DropDownTreePropsContext as J } from "./DropDownTree/DropDownTree.mjs";
23
+ import { MultiSelectTree as N, MultiSelectTreePropsContext as O } from "./MultiSelectTree/MultiSelectTree.mjs";
24
+ import { getMultiSelectTreeValue as R, getValueMap as U } from "./MultiSelectTree/utils.mjs";
4399
25
  export {
4400
- ri as AutoComplete,
4401
- li as AutoCompletePropsContext,
4402
- Mt as AutoCompleteWithoutContext,
4403
- ys as ComboBox,
4404
- ni as ComboBoxPropsContext,
4405
- dt as ComboBoxWithoutContext,
4406
- ei as DropDownList,
4407
- Tt as DropDownListClassComponent,
4408
- Zs as DropDownListPropsContext,
4409
- Tt as DropDownListWithoutContext,
4410
- ks as DropDownTree,
4411
- wi as DropDownTreePropsContext,
4412
- je as List,
4413
- Ft as ListContainer,
4414
- Re as ListFilter,
4415
- Gs as ListItem,
4416
- ss as MultiColumnComboBox,
4417
- vi as MultiColumnComboBoxPropsContext,
4418
- fi as MultiSelect,
4419
- ui as MultiSelectPropsContext,
4420
- is as MultiSelectTree,
4421
- Ni as MultiSelectTreePropsContext,
4422
- Nt as MultiSelectWithoutContext,
4423
- es as SearchBar,
4424
- Is as TagList,
4425
- ce as dropdownsMessages,
4426
- Wi as findByFieldValue,
4427
- V as getItemValue,
4428
- qi as getMultiSelectTreeValue,
4429
- tt as getValueMap,
4430
- ve as nodata,
4431
- zs as scrollToItem
26
+ W as AutoComplete,
27
+ V as AutoCompletePropsContext,
28
+ A as AutoCompleteWithoutContext,
29
+ T as ComboBox,
30
+ g as ComboBoxPropsContext,
31
+ h as ComboBoxWithoutContext,
32
+ e as DropDownList,
33
+ r as DropDownListClassComponent,
34
+ p as DropDownListPropsContext,
35
+ s as DropDownListWithoutContext,
36
+ H as DropDownTree,
37
+ J as DropDownTreePropsContext,
38
+ n as List,
39
+ C as ListContainer,
40
+ D as ListFilter,
41
+ x as ListItem,
42
+ z as MultiColumnComboBox,
43
+ E as MultiColumnComboBoxPropsContext,
44
+ F as MultiSelect,
45
+ y as MultiSelectPropsContext,
46
+ N as MultiSelectTree,
47
+ O as MultiSelectTreePropsContext,
48
+ j as MultiSelectWithoutContext,
49
+ a as SearchBar,
50
+ q as TagList,
51
+ L as dropdownsMessages,
52
+ w as findByFieldValue,
53
+ B as getItemValue,
54
+ R as getMultiSelectTreeValue,
55
+ U as getValueMap,
56
+ M as nodata,
57
+ P as scrollToItem
4432
58
  };